note 30432 deleted from function.mysql-fetch-array by betz
| From: | betz@php.net | Date: | Wed, 05 Oct 2005 11:39:15 +0000 |
| Subject: | note 30432 deleted from function.mysql-fetch-array by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96431@lists.php.net to get a copy of this message | ||
Note Submitter: loskutak at users dot sourceforge dot net
----
Following technique I am using when selecting from more tables with duplicates column names in
result.
As mentioned in manual mysql_fetch_array does not support fetching these duplicate column names in
associative array, even they are referenced by table name. There is also suggested to use "col
AS name" technique to solve that behavior.
So instead of:
"select table1.id, table1.text, table2.id, table2.text
from table1, table2
where table1.id=table2.id"
I am using:
"select table1.id as 'table1.id', table1.text as 'table1.text', table2.id
as 'table2.id', table2.text as 'table2.text'
from table1, table2
where table1.id=table2.id"
And now mysql_fetch_array works well.