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 :-) Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.