Jump to content

SELECT statement/multiple records/single user


Recommended Posts


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:


$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");
<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
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.