From:             lazybrain at rcn dot com
Operating system: freebsd 4.8-RELEASE-p3
PHP version:      4.3.3
PHP Bug Type:     MySQL related
Bug description:  mysql_fetch_assoc produces wrong data.

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 bug report at http://bugs.php.net/?id=25548&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25548&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25548&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25548&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25548&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25548&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25548&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25548&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25548&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25548&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25548&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25548&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25548&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25548&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25548&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25548&r=gnused

Reply via email to