Reply to Syntax for ambigous fields in a query with joins?

Your name:

Reply:


Posted by plaidthermos on 02/22/06 21:44

i found a topic on this question posted a couple years ago, but it
didn't really help me. my problem is the same as the original
poster's, that is, i have a query that returns multiple fields with the
same name. i need to access these in php via mysql_fetch_assoc, like
$row["field_name"]. the only response suggested using aliases in the
select, but that is not really practical, as i am selecting * from all
tables, and writing

select t1.field1 as t1f1, t2.field1 as t2f1, t1.field2 as t1f2,
t2.field2 as t2f2, t1.field3 as t1f3 ... t1.field100 as on and on and
on

is hardly desirable. does anyone know a way to access these fields
from php without specifying aliases in the sql select statement? i
don't really want to use field indices, as the table structure could
change and just because table.field1 is the first field in the table
today doesn't mean it always will be in that same position.

any solutions?

thanks,
-k

[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

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