|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25548 mysql_fetch_assoc produces wrong data.
Submitted: 2003-09-15 15:58 UTC Modified: 2003-09-16 09:48 UTC
From: lazybrain at rcn dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.3.3 OS: freebsd 4.8-RELEASE-p3
Private report: No CVE-ID: None
 [2003-09-15 15:58 UTC] lazybrain at rcn dot com
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) ) {

    $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><input type=text name=\"datein$x\" value=\"".$tmp['datein']."\"></td>
   <td><input type=text name=\"dateout$x\" value=\"".$tmp['dateout']."\"> ($tmp[rnumber])</td>


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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-16 09:48 UTC]
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 as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 11 10:01:29 2023 UTC