note 76921 deleted from function.PDOStatement-rowCount by bobby
| From: | bobby@php.net | Date: | Mon, 06 Aug 2007 14:32:17 +0000 |
| Subject: | note 76921 deleted from function.PDOStatement-rowCount by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-129213@lists.php.net to get a copy of this message | ||
Note Submitter: ludvig dot ericson at gmail dot com
----
I don't understand why PDOStatement::rowCount can't return the number of rows in the
result-set and there's *no* other way of counting the rows in the result-set. It's highly
awkward.
Anyway, the best way that I can think of is to use PDOStatement::fetchAll() and then just use
count() on the returned array, or use the shady tip that the PHP manual provides and use COUNT(*) in
your SELECT clause.
Truth be told, using count() is probably easier.