note 76921 added to function.PDOStatement-rowCount
| From: | ludvigdotericsonatgmaildotcom at osu1 dot php dot net | Date: | Sun, 05 Aug 2007 21:29:26 +0000 |
| Subject: | note 76921 added to function.PDOStatement-rowCount | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129195@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 212.63.193.10
Probable Submitter: 80.217.189.62
----
Manual Page -- http://www.php.net/manual/en/function.PDOStatement-rowCount.php
Edit -- https://master.php.net/note/edit/76921
Del: integrated -- https://master.php.net/note/delete/76921/integrated
Del: useless -- https://master.php.net/note/delete/76921/useless
Del: bad code -- https://master.php.net/note/delete/76921/bad+code
Del: spam -- https://master.php.net/note/delete/76921/spam
Del: non-english -- https://master.php.net/note/delete/76921/non-english
Del: in docs -- https://master.php.net/note/delete/76921/in+docs
Del: other reasons-- https://master.php.net/note/delete/76921
Reject -- https://master.php.net/note/reject/76921
Search -- https://master.php.net/manage/user-notes.php