/** * Return an entire result set from the database * @param string $query (can also be null to pull from the cache) * @param string $output ARRAY_A | ARRAY_N | OBJECT * @return mixed results */ function getArray($query = null, $output = ARRAY_A) { self::$func_call = __CLASS__ . "::getArray(\"{$query}\", {$output})"; if ($query) { self::query($query); } // Send back array of objects. Each row is an object if ($output == OBJECT) { return self::$last_result; } elseif ($output == ARRAY_A || $output == ARRAY_N) { if (self::$last_result) { $i = 0; foreach ((array) self::$last_result as $row) { if ($output == ARRAY_N) { // ...integer-keyed row arrays $new_array[$i] = array_values(get_object_vars($row)); } else { // ...column name-keyed row arrays $new_array[$i] = get_object_vars($row); } ++$i; } return $new_array; } else { return null; } } }