<?php
/**
* class resultset
*
* This class receives a resource-id and transforms it into usefull information
*
* @package database
* @copyright 2002, Jurgen Campforts
*/
class resultset {
var $_result;
/**
*
* resultset::resultset()
*
* Constructor
*
* @param $resultID the result from a query
* @return
* @version 18/10/2002
* @author jcam
*/
function resultset($resultID) {
$this->_result = $resultID;
}
/**
* resultset::numRows()
*
* Geeft aantal rijen terug van het resultaat
*
* @return aantal rijen dat in de select zit
* @version 18/11/2002
* @author jcam
*/
function numRows() {
return (@mysql_num_rows($this->_result));
}
/**
* fetchObject
*
* Gives a row back from the resultset. When there are no rows left it returns false
*
* @return object volgende rij in de resultset;
* false indien er geen rijen meer zijn.
* @version 28/10/2002
* @author jcam
*/
function fetchObject() {
return (@mysql_fetch_object($this->_result, MYSQL_ASSOC));
}
/**
* freeResult
*
* Gives al the memory back. It will be activated automaticaly at the end of the script,
* but can be called between.
*
* @return boolean true/false indien OK/niet OK.
* @version 28/10/2002
* @author jcam
*/
function freeResult() {
return (@mysql_free_result($this->_result));
}
/**
* as_obj_array
*
* Geeft alle rijen van de resultset terug als een array van objecten.
* met de kolomnamen als accessor functions.
*
* @return array array bevattende alle rijen van de resultset met associatief access.
*/
function as_obj_array() {
while($arr = $this->fetchObject()) {
$result[]=$arr;
}
return $result;
}
}
?>