ze\row::getArray()
ze\row::getArray($table, $cols, $ids = [], $orderBy = [], $indexBy = false, $ignoreMissingColumns = false, $limit = false)
Gets multiple rows from a given table in the database as a PHP array.
$table
The name of a table to check.
You do not need to add the DB_PREFIX
, this will be added automatically.
$cols
This can be either the name of a column, or an array of column names. This can be set to true to perform a SELECT * query, returning every column in the table. However, as per our coding practices, you should not do this unless you do need every row in the table.
$ids
An associative array of keys (column names) to values to search for; see Format of $id and $values for Database Functions for details. If multiple rows match, only the first one to be found will be returned.
$notZero
If set to true
, this function will insist that the value returned must not be zero. Defaults to false
.
Only has any effect if you enter the name of a numeric column into $cols
, and will be ignored if you enter an array of column names into $cols
.
This will return a PHP array, containing all of the rows found.
If the table has one column declared as a primary key, the array will be an associative array indexed by this column.
If $cols was given the name of a column then the array will be a one-dimensional array, containing one entry for value of the column. Otherwise it will be a two-dimensional array, containing an associative arrays of keys (column names) => values for each row.