phpbeginner Posted April 15, 2007 Share Posted April 15, 2007 I'm sure this is an easy one. I have links to a page which grabs a name from table and inserts the data to the page.....Ex: domain.com/pagename.php?view=NAME which works fine. I am trying to insert data also from another table and can't seem to get it to work. Here is what I am doing..... I am getting the data using $rs=mysql_query("select * from tblxxxxWHERE name='$view'"); which works fine but then I am also trying to get the data based on the same $view as below.. $rs=mysql_query("select * from tblyyyyy WHERE team='$view'"); Any advice as the second one will not display any results. I am learning bit by bit and it looked to me as though this would work but obviously does not. Thanks In Advance Quote Link to comment https://forums.phpfreaks.com/topic/47144-solved-display-from-mutliple-tables/ Share on other sites More sharing options...
Eugene Posted April 15, 2007 Share Posted April 15, 2007 SELECT * FROM tblxxxx x JOIN tblyyyy y ON x.name = y.team WHERE x.name = '$view' Quote Link to comment https://forums.phpfreaks.com/topic/47144-solved-display-from-mutliple-tables/#findComment-229914 Share on other sites More sharing options...
phpbeginner Posted April 15, 2007 Author Share Posted April 15, 2007 $rs=mysql_query("select * from tbldivision JOIN tblteam ON division.name = team.team WHERE division.name='$view'"); This is what I have now ....is that what you meant ? Quote Link to comment https://forums.phpfreaks.com/topic/47144-solved-display-from-mutliple-tables/#findComment-229917 Share on other sites More sharing options...
Eugene Posted April 15, 2007 Share Posted April 15, 2007 you sort of got it wrong, can you tell me that two tables you want to join? Quote Link to comment https://forums.phpfreaks.com/topic/47144-solved-display-from-mutliple-tables/#findComment-229934 Share on other sites More sharing options...
phpbeginner Posted April 15, 2007 Author Share Posted April 15, 2007 tbldivision and tblteam When linking to this page I have it linking from tbldivision. It links to this page ---->team.php?view=name I then have records in tbldivision and tblteam I want to display based on the =name The common field between these 2 is tbldivision fld name and tblteam fld team. Thanks Eugene, I appreciate the help. Quote Link to comment https://forums.phpfreaks.com/topic/47144-solved-display-from-mutliple-tables/#findComment-229940 Share on other sites More sharing options...
phpbeginner Posted April 16, 2007 Author Share Posted April 16, 2007 Sorry all, it does work as I thought it should....I had a different error which was causing the problem. Quote Link to comment https://forums.phpfreaks.com/topic/47144-solved-display-from-mutliple-tables/#findComment-230491 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.