Posted by Paul E Collins on 10/15/62 11:39
I'm using mysql_fetch_array to run a query along these lines:
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".
Of course, using just 'name' would be ambiguous because the query also
retrieves B.name (and my actual query will involve more tables and
probably select '*' [i.e. all columns], so it isn't trivial to use
'AS' to provide individual column aliases).
How can I access a column's value based on table *and* column name?
P.
[Back to original message]
|