note 25880 added to function.mysql-fetch-array
| From: | glenn dot hoeppner at yakhair dot com | Date: | Wed, 09 Oct 2002 19:04:18 +0000 |
| Subject: | note 25880 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37862@lists.php.net to get a copy of this message | ||
Just another workaround for columns with duplicate names...
Modify your SQL to use the AS keyword.
Instead of:
$sql = "SELECT t1.cA, t2.cA FROM t1, t2 WHERE t1.cA = t2.cA";
Try:
$sql = "SELECT t1.cA AS foo1, t2.cA AS foo2 FROM t1, t2 WHERE t1.cA = t2.cA";
Then you can reference the results by name in the array:
$row[foo1], $row[foo2]
--
http://www.php.net/manual/en/function.mysql-fetch-array.php
http://master.php.net/manage/user-notes.php?action=edit+25880
http://master.php.net/manage/user-notes.php?action=delete+25880
http://master.php.net/manage/user-notes.php?action=reject+25880