function fetch_assoc_all($index = '', $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 ($this->_is_result($resource) || is_integer($resource) && isset($this->cached_results[$resource])) {
// this is the array that will contain the results
$result = array();
// move the pointer to the start of $resource
// if there are any rows available (notice the @)
if (@$this->seek(0, $resource)) {
// iterate through the records
while ($row = $this->fetch_assoc($resource)) {
// if $index was specified and exists in the returned row, add data to the result
if (trim($index) != '' && isset($row[$index])) {
$result[$row[$index]] = $row;
} else {
$result[] = $row;
}
}
}
// return the results
return $result;
// 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;
}