Db::getRow

Usage

?array Db::getRow(string $sql, [ ... $args ])

Description

Get the first row retrived as an associative array.

Parameters

Parameter Required Type Description
$sql Yes string The SQL statement to execute, which can contain placeholders (ie. %s, %i, %b, et al). For full details, please see the Database Placeholders page of the documentation.
$args No desc=

Return Value

Returns an associative array of the first record found, or null if no records found.

Examples

Get Row


$price = 49.95; if (!$row = $this->db->getRow("SELECT * FROM products WHERE is_active = %b AND price > %d ORDER BY price", true, $id)) { die("No products found"); } print_r($row);

See Also