note 77771 rejected from function.PDOStatement-rowCount by nlopess
| From: | nlopess@php.net | Date: | Wed, 12 Sep 2007 19:10:45 +0000 |
| Subject: | note 77771 rejected from function.PDOStatement-rowCount by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130429@lists.php.net to get a copy of this message | ||
Note Submitter: miha dot wagner at gmail dot com
----
I have tried this example:
<?php
$sql = $pdo->prepare("SELECT * FROM foo WHERE bar=1");
$sql->execute();
echo "There are " .count($sql->fetchAll()) ." rows where bar=1";
?>
I am just wondering. Is this a valid way of counting rows from a SELECT statement?
Thanks!