From: dario_primorac at net dot hr Operating system: Linux PHP version: 4.3.2 PHP Bug Type: Output Control Bug description: mysql_fetch_row mysql_result interaction
Description: ------------ Table employees has 3 colons (name,surname,position). The table is filled with 3 values. When the code is executed it forces a endless while loot, and the browser must be terminated, and my opinion is that this code sholuld not do that. My opinion is: the mysql_result and mysql_fetch_row functions are using the same pointer as the handle (return value). It is my opinion that the while loop will go around (n,n+1) value where n is number of row fetched by mysql_result function. Reproduce code: --------------- <?php $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $result = mysql_query("SELECT * FROM employees",$db); echo "<table border=1>\n"; echo "<tr><td>Name</td><td>Position</tr>\n"; while ($myrow = mysql_fetch_row($result)) { printf("<tr><td>%s %s</td><td>%s</td></tr>\n", mysql_result($result,1,"name") , $myrow[1], $myrow[2]); } echo "</table>\n"; ?> Expected result: ---------------- Lets say that the table employee was filled with this data: name surname position ---- ------- -------- Dario Primorac 1 Mario Butijer 2 Vido Vlahinic 3 The result should be: Name Position Mario Primorac 1 Mario Butijer 2 Mario Vlahinic 3 Actual result: -------------- When the code is executed it forces a endless while loot, and the browser must be terminated. -- Edit bug report at http://bugs.php.net/?id=26136&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26136&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26136&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26136&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26136&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26136&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26136&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26136&r=support Expected behavior: http://bugs.php.net/fix.php?id=26136&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26136&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26136&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26136&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26136&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26136&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26136&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26136&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26136&r=float