Reply to mysql_fetch_array and table aliases

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация