Function ze\row::query()

In PHP:
ze\row::query(
$table, $cols, $ids, $orderBy = [], $indexBy = false, $ignoreMissingColumns = false, $limit = false, $storeResult = true
)

Description

Gets multiple rows from a given table in the database.

Parameters

$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.

Return Value

The result of a mysql_query() function call.

Example

getRows('users', array('id, 'username'), array('first_name' => 'Bob'), 'last_name');

Gets the id and username of all users whose first name is "Bob", ordered by their last name.