Db::fetchArray
Usage
?array Db::fetchArray(PDOStatement $stmt, [ ?int $position = null ])Description
Get the next row of a query result as a numbered array.Parameters
Parameter | Required | Type | Description |
---|---|---|---|
$stmt | Yes | PDOStatement | The query result returned by the query() method. |
$position | No | ?int |
Return Value
?A numbered array of the row or null if no row exists.yExamples
Fetch Array
$cat_id = 59;
$result = $this->db->query("SELECT * FROM products WHERE category_id = %i ORDER BY name", $cat_id);
while ($row = $this->db->fetchArray($result)) {
print_r($row);
}