function fetch_assoc($resource = '')
{
// if an active connection exists
if ($this->_connected()) {
// if no resource was specified, and a query was run before, assign the last resource
if ($resource == '' && isset($this->last_result)) {
$resource =& $this->last_result;
}
// if $resource is a valid resource, fetch and return next row from the result set
if ($this->_is_result($resource)) {
return mysqli_fetch_assoc($resource);
} elseif (is_integer($resource) && isset($this->cached_results[$resource])) {
// get the current entry from the array and advance the pointer
$result = each($this->cached_results[$resource]);
// return as an associative array
return @$result[1];
// if $resource is invalid
} else {
// save debug information
$this->_log('errors', array('message' => $this->language['not_a_valid_resource']));
}
}
// we don't have to report any error as either the _connected() method already did
// or did so the checking for valid resource
return false;
}