clint Posted March 15, 2011 Share Posted March 15, 2011 Hello, Please excuse me if this sounds like a bit of a newb question. If I have a link to a users profile and use GET to pull information about that user from various tables using something like this: <?php { $id = $_GET['id']; $user = mysql_query("SELECT * FROM users,tbl1,tbl2,tbl3,tbl4,tbl5 WHERE $id=tbl1.user_id AND tbl1.user_id=tbl2.user_id AND tbl2.user_id=tbl3.user_id ANDtbl3.user_id=tbl4.user_id AND tbl4.user_id=tbl5.user_id"); $user=mysql_fetch_assoc($user); } ?> <h3>Table 1</H3> <?php echo "<b>".$user['tbl1_title']."<br>"; ?><br /> <h3>Table 2</H3> <?php echo "<b>".$user['tbl2_title']."<br>"; ?><br /> <h3>Table 3</H3> <?php echo "<b>".$user['tbl3_title']."<br>"; ?><br /> <h3>Table 4</H3> <?php echo "<b>".$user['tbl4_title']."<br>"; ?><br /> <h3>Table 5</H3> <?php echo "<b>".$user['tbl5_title']."<br>"; ?><br /> Why does it only show the 1st record for that user from each table? And mostly, how do I change it to show all or a certain number of records from each table? Any help would be greatly appreciated. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/230685-select-statementmultiple-recordssingle-user/ Share on other sites More sharing options...
sasa Posted March 16, 2011 Share Posted March 16, 2011 you query returns more than 1 result but you print just one Link to comment https://forums.phpfreaks.com/topic/230685-select-statementmultiple-recordssingle-user/#findComment-1188043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.