php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lazybrain at rcn dot com
New email:
PHP Version: OS:

 

 [2003-09-15 15:58 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-16 09:48 UTC] georg@php.net
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.

.. 
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Dec 04 15:05:54 2022 UTC