Db::getSelectCount

Usage

int Db::getSelectCount(PDOStatement $stmt)

Description

Get total number of rows container within result of a select statement.

Parameters

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

Return Value

The total number of rows returned by the select statement.

Examples

Get Select Count


$result = $this->db->query("SELECT * FROM products WHERE is_active = %b ORDER BY name", true); $count = $this->db->getSelectCount($result); echo "Returned total of $total rows\n";

See Also