DB_common::getAll()

DB_common::getAll() -- Fetch all rows

Synopsis

array &getAll (string $query [, mixed $params [, integer $fetchmode = DB_FETCHMODE_DEFAULT]])

Description

Fetch the entire result set of a query into a nested array. The function takes care of doing the query and freeing the results when finished.

Parameter

string $query

the SQL query or the statement to prepare

mixed $params

array to be used in execution of the statement. Quantity of array elements must match quantity of placeholders in query. This function does NOT support scalars.

prepare()/ execute() is used.

integer $fetchmode

the fetch mode to use, default is DB_FETCHMODE_DEFAULT

Return value

Throws

Table 21-1. Possible PEAR_Error values

Error codeError messageReasonSolution
DB_ERROR_INVALID NULL SQL statment for preparing is not valid. See the prepare() documentation, if you want to use a SQL statemt using placeholders.
DB_ERROR_MISMATCH NULL Quantity of parameters didn't match quantity of placeholders in the prepared statment. Check that the number of placeholders in the prepare() statement passed to $query equals the count of entries passed to $params.
DB_ERROR_NODBSELECTED NULL No database was choosen. Check the DSN in connect().
every other error code  Database specific error Check the database related section of PHP-Manual to detect the reason for this error. In the most cases a misformed SQL statment. Ie. using LIMIT in a SQL-Statment for an Oracle database.

Note

This function can not be called statically.

See

query(), limitQuery(), prepare(), execute(), getCol(), getRow(), getAssoc(), getOne()