php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40400 mysql_fetch functions return n times the same line
Submitted: 2007-02-08 10:49 UTC Modified: 2007-02-08 11:41 UTC
From: guillaume dot david at noos dot fr Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.0 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: guillaume dot david at noos dot fr
New email:
PHP Version: OS:

 

 [2007-02-08 10:49 UTC] 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 ) 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-08 11:18 UTC] guillaume dot david at noos dot fr
This bug doesn't seem to happen on other servers.
 [2007-02-08 11:41 UTC] tony2001@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.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Not PHP problem.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Feb 05 07:00:01 2026 UTC