[EMAIL PROTECTED] wrote:
The tables I have are the following with the field 'Name' appearing in
each table:
`section`.`Name`
`district`.`Name`
`building`.`Name`
Then I have:
$Section = $row[Name];
$Building = $row[Name];
See my problem? "Name" is the same field name in two different tables.
I tried to do something like:
You need to give an alias for each of those name columns in order to
access it that way:
Select section.Name as section_name, district.Name as district_name, etc...
Then you can do:
$Section = $row['section_name'];
Alternatively, you can access them by the numerical index in $row, but
that's not very reliable because if your query changes at all, you'll
have to update your variable assignments. This is what I'm talking about:
Select section.Name, district.Name, etc...
$Section = $row[0];
$District = $row[1];
I'd recommend the first way.
-Rob
_______________________________________________
New York PHP Community MySQL SIG
http://lists.nyphp.org/mailman/listinfo/mysql
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php