note 74322 deleted from pdostatement.fetch by danbrown
| From: | danbrown@php.net | Date: | Tue, 21 Jun 2011 15:07:39 +0000 |
| Subject: | note 74322 deleted from pdostatement.fetch by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180815@lists.php.net to get a copy of this message | ||
Note Submitter: redcube
----
as an alternative for marcini's note:
just clear the statement variable before you issue another query:
<?php
$stmt = $db->prepare('SELECT * FROM test');
// fetch only the first row
$row = $stmt->fetch(PDO::FETCH_ASSOC);
// clear the variable so its contents are destroyed (including the other rows in the result)
$stmt = null;
// now you can issue another query
$stmt = $db->prepare('SELECT * FROM test2');
?>