Efficiently getting number of rows returned of SELECT query with WHERE clause using PDO
问题 There are numerous discussions on SO regarding how to get the number of rows returned when running a SELECT query using PDO. While most (including the PHP manual) suggest using two queries, with the first running COUNT() , I haven't seen one that suggested how to easily do this using prepared statements with WHERE clauses. How do I most-efficiently (both in processing and number of lines of code) run a COUNT() using the same WHERE clause? The prepared query already has the columns specified.