Jump to content

Multiple tables with matching field names


Buzz.

Recommended Posts

Hi, in mysql I am used to handling matching field names across tables like:-

 

select date,tableone.sname,tabletwo.sname from tableone left join tabletwo on tableone.id=tabletwo.id;

 

but using this method with php doesn't seem to work for me

$result=mysql_query("select date,tableone.sname,tabletwo.sname from tableone left join tabletwo on tableone.id=tabletwo.id order by date",$sqlconn);

 

$sname=mysql_result($result,$i,".tableone.sname");

$sname2=mysql_result($result,$i,"tabletwo.sname");

 

I only seem to get 1 "sname" value, ie.

$sname=mysql_result($result,$i,"sname");

 

I've tried to search for examples of this but failed, please help a php newbie :-)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.