ID: 40400
User updated by: guillaume dot david at noos dot fr
Reported By: guillaume dot david at noos dot fr
Status: Open
Bug Type: MySQL related
Operating System: Windows 2000
PHP Version: 5.2.0
New Comment:
This bug doesn't seem to happen on other servers.
Previous Comments:
------------------------------------------------------------------------
[2007-02-08 10:49:40] guillaume dot david at noos dot fr
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 this bug report at http://bugs.php.net/?id=40400&edit=1