note 105459 deleted from pdostatement.rowcount by cmb
| From: | cmb@php.net | Date: | Mon, 24 Aug 2015 23:03:08 +0000 |
| Subject: | note 105459 deleted from pdostatement.rowcount by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203456@lists.php.net to get a copy of this message | ||
Note Submitter: dcahh at gmx dot de
----
It's pretty obvious, but might save one or the other from bug tracking...
Alltough rowCount ist returned by the statement, one has to execute the statement before rowCount
returns any results...
Does not work
<?php
$statement = $dbh->prepare('SELECT FROM fruit');
$count = $statement->rowCount();
?>
Works
<?php
$statement = $dbh->prepare('SELECT FROM fruit');
$statement->execute();
$count = $statement->rowCount();
?>