Jump to content

SELECT statement/multiple records/single user


clint

Recommended Posts

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  :)

Archived

This topic is now archived and is closed to further replies.

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