|
Posted by Ewoud Dronkert on 10/13/34 11:39
Paul E Collins wrote:
> SELECT A.name, B.name FROM A, B WHERE A.id = B.id
>
> I tried this code:
>
> while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
> {
> echo $row['A.name'];
> }
>
> ... but the echo statement produces "Notice: Undefined index: A.name".
1. (very bad) use $row[0] and $row['name']
2. (bad) use mysql_fetch_row(), $row[0], $row[1]. Doesn't work with
"select *".
3. (best) alias all duplicate column names using "as".
--
E. Dronkert
Navigation:
[Reply to this message]
|