====== PDO - Get row count ====== query('SELECT * FROM table'); $row_count = $stmt->rowCount(); echo $row_count.' rows selected'; **NOTE**: Though the documentation says this method is only for returning affected rows from //UPDATE, INSERT, DELETE// queries, with the **PDO_MYSQL** driver (and this driver only) you can get the row count for SELECT queries. Keep this in mind when writing code for multiple databases. This is because MySQL's protocol is one of the very few that give this information to the client for SELECT statements. Most other database vendors don't bother divulging this information to the client as it would incur more overhead in their implementations.