note 81095 added to function.PDOStatement-rowCount
| From: | ethan dot nelson at ltd dot org | Date: | Thu, 14 Feb 2008 00:17:17 +0000 |
| Subject: | note 81095 added to function.PDOStatement-rowCount | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136131@lists.php.net to get a copy of this message | ||
Another way to count and maintain the iterator is to use a cloned variable.
$counttest = clone $pdostatment;
$num = sizeof($counttest->fetchAll());
$row1 = $dbs->fetch();
Note cloning a large result set is grossly inefficient. SQL can handle a count statement alot
faster, but if you are trying to migrate alot of code which makes extensive use of mssql_num_rows()
quickly, this will do the trick.
----
Server IP: 208.69.120.35
Probable Submitter: 140.211.84.125
----
Manual Page -- http://www.php.net/manual/en/function.PDOStatement-rowCount.php
Edit -- https://master.php.net/note/edit/81095
Del: integrated -- https://master.php.net/note/delete/81095/integrated
Del: useless -- https://master.php.net/note/delete/81095/useless
Del: bad code -- https://master.php.net/note/delete/81095/bad+code
Del: spam -- https://master.php.net/note/delete/81095/spam
Del: non-english -- https://master.php.net/note/delete/81095/non-english
Del: in docs -- https://master.php.net/note/delete/81095/in+docs
Del: other reasons-- https://master.php.net/note/delete/81095
Reject -- https://master.php.net/note/reject/81095
Search -- https://master.php.net/manage/user-notes.php