#25548 [Opn->Bgs]: mysql_fetch_assoc produces wrong data.
| From: | georg@php.net | Date: | Tue, 16 Sep 2003 13:48:43 +0000 |
| Subject: | #25548 [Opn->Bgs]: mysql_fetch_assoc produces wrong data. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47631@lists.php.net to get a copy of this message | ||
ID: 25548
Updated by: georg@php.net
Reported By: lazybrain at rcn dot com
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: freebsd 4.8-RELEASE-p3
PHP Version: 4.3.3
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
..
Previous Comments:
------------------------------------------------------------------------
[2003-09-15 15:58:56] lazybrain at rcn dot com
Description:
------------
mysql_fetch_assoc somehow caches results.
Reproduce code:
---------------
$results = mysql_query("select id,datein,dateout,rnumber from
repairrecords limit 1800,100");
echo "<table align=center><form action=fixdate.php method=post>";
while($tmp = mysql_fetch_assoc($results) ) {
<tr>
<td>
$tmp[id] <input type=hidden name=\"cpid$x\"
value=\"$tmp[pid]\">
<input type=hidden name=\"cid$x\" value=\"$tmp[id]\">
<input type=hidden name=\"crnumber$x\" value=\"$tmp[rnumber]\">
</td>
<td><input type=text name=\"datein$x\"
value=\"".$tmp['datein']."\"></td>
<td><input type=text name=\"dateout$x\"
value=\"".$tmp['dateout']."\"> ($tmp[rnumber])</td>
</tr>
}
Expected result:
----------------
when you change limit in the query from 1800,100 to 1900,100
It gives you the last 100 results.
HOWEVER, if you do print_r($tmp) inside of the while loop it works.
This does not happen every time. When it does happen,
it continues to give the wrong results. Makes no sense to me.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25548&edit=1