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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 03 03:01:29 2024 UTC