PHP 4.0 Bug #3061: MySQL fails in queries containing several tables sharing an attribute name
| From: | johan at nasholm dot net | Date: | Tue, 28 Dec 1999 23:22:31 +0000 |
| Subject: | PHP 4.0 Bug #3061: MySQL fails in queries containing several tables sharing an attribute name | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-14118@lists.php.net to get a copy of this message | ||
From: johan@nasholm.net
Operating system: RedHat 6.1
PHP version: 4.0 Beta 3
PHP Bug Type: MySQL related
Bug description: MySQL fails in queries containing several tables sharing an attribute name
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>";
}