php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3061 MySQL fails in queries containing several tables sharing an attribute name
Submitted: 1999-12-28 18:22 UTC Modified: 2000-07-25 23:15 UTC
From: johan at nasholm dot net Assigned:
Status: Closed Package: MySQL related
PHP Version: 4.0 Beta 3 OS: RedHat 6.1
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: johan at nasholm dot net
New email:
PHP Version: OS:

 

 [1999-12-28 18:22 UTC] johan at nasholm dot net
Given a database consisting of, say, two tables Images and Portfolios who share the attribute 'Name' the following code will fail while fetching the second row of the result saying

Warning: Images not found in MySQL result index 7 in
/home/httpd/html/bildbank/http/search/result.phtml on line 309

Wierd this is that it works on the first row of the result.. This problem did not occur in PHP3



$SQL = "SELECT * FROM Images, Portfolios WHERE Images.Idx = Portfolios.ImageID";
$res = mysql("imagedb", $SQL);

for ($i = 0; $i < mysql_numrows($res); $i++) {
	$imgName = mysql_result($res, $i, "Images.Name");
	echo "$imgName<br>";
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-25 00:57 UTC] zak@php.net
This does not appear to be a PHP error.
I would recommend testing your queries directly in MySQL.

 [2000-07-25 23:15 UTC] zak@php.net
User wrote to say that problem does not happen in PHP 4.0.1
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 05:01:33 2025 UTC