note 77770 rejected from function.PDOStatement-rowCount by nlopess

From: Date: Wed, 12 Sep 2007 19:10:43 +0000
Subject: note 77770 rejected from function.PDOStatement-rowCount by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-130428@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!

« previous php.notes (#130428) next »