mysql_num_rows() alternative for PDO

Returns total rows after executed query in PDO.

php
fork add to bundle source
function mysql_rows_count($statement) { return count($statement->fetchAll(PDO::FETCH_ASSOC)); }

usage

load_function('mysql_rows_count'); $pdo = new PDO('mysql:host=127.0.0.1;dbname=db', 'user', 'pwd'); $stmt = $pdo->query("SELECT * FROM users"); echo mysql_rows_count($stmt); // 3
← how to use this in app?
create log ...inout