Db::numRows

Usage

int Db::numRows(PDOStatement $stmt)

Description

Get the number of rows affected by a query result.

Parameters

Parameter Required Type Description
$stmt Yes PDOStatement The PDOStatement instance as returned by the query() method.

Return Value

The number of rows that were affected by the previous SQL statement.

Examples

Get Num Rows



// Delete $result = $this->db->query("DELETE FROM products WHERE is_active = %b", false); $num = $this->db->numRows($result); echo "Total of $total rows were deleted.\n";

See Also