Db::fetchAssoc
Usage
?array Db::fetchAssoc(PDOStatement $stmt, [ ?int $position = null ])Description
Get he next row of a query result as an associative array with column names.Parameters
Parameter | Required | Type | Description |
---|---|---|---|
$stmt | Yes | PDOStatement | The query result returned by the query() method. |
$position | No | ?int |
Return Value
An associate array of the next record within the result set, or null if no record exists.Examples
db->query("SELECT * FROM products WHERE category_id = %i ORDER BY name", $cat_id);
while ($row = $this->db->fetchAssoc($result)) {
print_r($row);
}