There are many conflicting statements around. What is the best way to get the row count using PDO in PHP? Before using PDO, I just simply used mysql_num_rows.>
mysql_num_rows
I ended up using this:
$result = $db->query($query)->fetchAll(); if (count($result) > 0) { foreach ($result as $row) { echo $row['blah'] . ''; } } else { echo "Nothing matched your query."; }
Nothing matched your query.