note 93917 added to function.mysql-result
| From: | DJK at osu1 dot php dot net | Date: | Tue, 06 Oct 2009 21:00:12 +0000 |
| Subject: | note 93917 added to function.mysql-result | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161413@lists.php.net to get a copy of this message | ||
Note that mysql_result affects the internal pointer used by mysql_fetch_*
<?php
$res = mysql_query('SELECT a,b FROM ab');
echo mysql_result($res,0,0);
print_r(mysql_fetch_assoc($res));
?>
In the above example, the call to mysql_fetch_assoc would return the SECOND result, not the first as
(I) expected.
Use mysql_data_seek($res,0) to reset the result set.
----
Server IP: 66.207.199.35
Probable Submitter: 24.87.204.44
----
Manual Page -- http://www.php.net/manual/en/function.mysql-result.php
Edit -- https://master.php.net/note/edit/93917
Del: integrated -- https://master.php.net/note/delete/93917/integrated
Del: useless -- https://master.php.net/note/delete/93917/useless
Del: bad code -- https://master.php.net/note/delete/93917/bad+code
Del: spam -- https://master.php.net/note/delete/93917/spam
Del: non-english -- https://master.php.net/note/delete/93917/non-english
Del: in docs -- https://master.php.net/note/delete/93917/in+docs
Del: other reasons-- https://master.php.net/note/delete/93917
Reject -- https://master.php.net/note/reject/93917
Search -- https://master.php.net/manage/user-notes.php