note 74322 added to function.PDOStatement-fetch
| From: | redcube at osu1 dot php dot net | Date: | Thu, 05 Apr 2007 09:53:29 +0000 |
| Subject: | note 74322 added to function.PDOStatement-fetch | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125106@lists.php.net to get a copy of this message | ||
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');
?>
----
Server IP: 212.124.37.9
Probable Submitter: 194.173.174.20
----
Manual Page -- http://www.php.net/manual/en/function.PDOStatement-fetch.php
Edit -- https://master.php.net/note/edit/74322
Del: integrated -- https://master.php.net/note/delete/74322/integrated
Del: useless -- https://master.php.net/note/delete/74322/useless
Del: bad code -- https://master.php.net/note/delete/74322/bad+code
Del: spam -- https://master.php.net/note/delete/74322/spam
Del: non-english -- https://master.php.net/note/delete/74322/non-english
Del: in docs -- https://master.php.net/note/delete/74322/in+docs
Del: other reasons-- https://master.php.net/note/delete/74322
Reject -- https://master.php.net/note/reject/74322
Search -- https://master.php.net/manage/user-notes.php