#40400 [NEW]: mysql_fetch functions return n times the same line

From: Date: Thu, 08 Feb 2007 10:49:40 +0000
Subject: #40400 [NEW]: mysql_fetch functions return n times the same line
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-108576@lists.php.net to get a copy of this message
From: guillaume dot david at noos dot fr Operating system: Windows 2000 PHP version: 5.2.0 PHP Bug Type: MySQL related Bug description: mysql_fetch functions return n times the same line Description: ------------ I thinks i have found a bug in the mysql_fetch_row, mysql_fetch_array and mysql_fetch_assoc functions. When I select twice the same field with 2 different tags, mysql_fetch_* always return the same line. Reproduce code: --------------- <?php include "conf.php"; $sql = "SELECT DISTINCT page as CHAMP, page as VALEUR FROM logs WHERE 1 ORDER BY CHAMP ASC"; $q = mysql_query($sql) or die (mysql_error()); while($foo = mysql_fetch_array($q)) { print_r($foo); echo '<br>'; } ?> Expected result: ---------------- Array ( [0] => accueil.php [CHAMP] => accueil.php [1] => accueil.php [VALEUR] => accueil.php ) Array ( [0] => logs.php [CHAMP] => logs.php [1] => logs.php [VALEUR] => logs.php ) Actual result: -------------- Array ( [0] => logs.php [CHAMP] => logs.php [1] => logs.php [VALEUR] => logs.php ) Array ( [0] => logs.php [CHAMP] => logs.php [1] => logs.php [VALEUR] => logs.php ) -- Edit bug report at http://bugs.php.net/?id=40400&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40400&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40400&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40400&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40400&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40400&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40400&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40400&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40400&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40400&r=support Expected behavior: http://bugs.php.net/fix.php?id=40400&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40400&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40400&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40400&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40400&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40400&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40400&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40400&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40400&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40400&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40400&r=mysqlcfg

« previous php.bugs (#108576) next »