I'm using a query similar to:
select tableA.*, tableB.* from tableA,
left join tableB ON tableA.keyfield = tableB.keyfield
When I then try to access the column keyfield, after using
mysql_fetch_object() e.g.
$resultObject-keyfield
I get no value returned. What is the correct way to reference a field/column
that has the same name (as it's a primary and foreign key) on both tables?
Is there some syntax like:
$resultObject-tableA.keyfield ?
I've tried specifically aliasing the field on tableA e.g.
select tableA.*, tableA.keyfield AS myKeyField, tableB.* from tableA,
left join tableB ON tableA.keyfield = tableB.keyfield
and then using $resultObject-myKeyField but that doesn't seem to work
either.
I can't find any useful info/examples about this on the PHP site.
Also if I change the query to be:
select tableA.*, tableB.* from tableA, tableB
left join tableB ON tableA.keyfield = tableB.keyfield
adding the joined table to the FROM clause I get an error. Surely this is
the correct syntax and if anything my initial syntax should fail! Am I not
understanding this correctly or is my mySQL manual out of sync?
Please help
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]