You can issue a SELECT FOUND_ROWS()
query right after the original SELECT
query to get row count.
$pdo->query("SELECT * FROM users");
$foundRows = $pdo->query("SELECT FOUND_ROWS()")->fetchColumn();
See also: MySQL Docs on FOUND_ROWS()
More Related Contents:
- mysqli or PDO – what are the pros and cons? [closed]
- What is the difference between bindParam and bindValue?
- How do I create a PDO parameterized query with a LIKE statement?
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- PHP PDO: charset, set names?
- How to get numeric types from MySQL using PDO?
- PDO prepared statement – what are colons in parameter names used for?
- php pdo: get the columns name of a table
- Use bound parameter multiple times
- What is the difference between MySQL, MySQLi and PDO? [closed]
- Why is PDO better for escaping MySQL queries/querystrings than mysql_real_escape_string?
- PDO bindParam vs. execute
- how safe are PDO prepared statements
- Can I use a PDO prepared statement to bind an identifier (a table or field name) or a syntax keyword?
- PDO error message? [duplicate]
- PHP PDO – Num Rows
- php pdo prepare repetitive variables
- How to solve General error: 2006 MySQL server has gone away
- Replacing mysql_* functions with PDO and prepared statements
- How to make PDO run SET NAMES utf8 each time I connect, In ZendFramework
- How do I sanitize input with PDO?
- Calling stored procedure with Out parameter using PDO
- How to insert an array into a single MySQL Prepared statement w/ PHP and PDO
- Setting a connect timeout with PDO
- What is the best way to insert multiple rows in PHP PDO MYSQL?
- PDO MySQL: Insert multiple rows in one query
- How to bind LIKE values using the PDO extension?
- Warning: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in
- PDO LIMIT and OFFSET [duplicate]
- I’m getting this error code: Invalid argument supplied for foreach() [duplicate]