Buzz. Posted February 13, 2007 Share Posted February 13, 2007 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 :-) Link to comment https://forums.phpfreaks.com/topic/38315-multiple-tables-with-matching-field-names/ Share on other sites More sharing options...
fenway Posted February 13, 2007 Share Posted February 13, 2007 You need to use column aliases, since they both have the same name, so you're getting hash key collision. Link to comment https://forums.phpfreaks.com/topic/38315-multiple-tables-with-matching-field-names/#findComment-183634 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.