diff --git a/classes/db_pdo.php b/classes/db_pdo.php index ef66996..85da6c7 100644 --- a/classes/db_pdo.php +++ b/classes/db_pdo.php @@ -359,6 +359,20 @@ abstract class DB_PDO extends PDO { return ($filtered_index) ? db_filter($all, 0) : $all; } + + // -------------------------------------------------------------------------- + + /** + * Return the number of rows returned for a SELECT query + * + * @return int + */ + public function num_rows() + { + return isset($this->statement) && is_object($this->statement) + ? $this->statement->rowCount() + : FALSE; + } // ------------------------------------------------------------------------- // ! Abstract public functions to implement in child classes @@ -373,13 +387,6 @@ abstract class DB_PDO extends PDO { */ abstract public function truncate($table); - /** - * Return the number of rows for the last SELECT query - * - * @return int - */ - abstract public function num_rows(); - /** * Connect to a different database * diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index 736631a..23dfdd0 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -96,7 +96,7 @@ the connection/database
get_system_tables()
inTransaction()
lastInsertId()
num_rows()
num_rows()
prepare()
prepare_execute()
num_rows() : int