Jump to content

friend Image - Kinda Linking Database


shorty3

Recommended Posts

Right i want to have friends displayed on peoples profiles but i can only ave there name and not the avater displayed here is the code ive got which doesnt work

 

        <? 
$picture = mysql_query("SELECT * FROM users WHERE username = '$dip->person'");
$pc = mysql_fetch_object($picture);
$query_friends=mysql_query("SELECT * FROM friends WHERE username='$viewuser' AND type='Friend'");

$rows=mysql_num_rows($query_friends);
if ($rows == "0"){ echo "<center>No friends</center>"; }
$friend = 0;
while($dip=mysql_fetch_object($query_friends)){

echo "  <img src='$pc->image' width='50' height='50' border='1'><br><a href='profile.php?viewuser=$dip->person'>$dip->person</a>,"; 
$friend++; 
echo ($friend % 3 == 0)? "<br>" : ""; }
?>

 

 

The friends are from the friends database and the avater is from the users database how can i link them so the name and the avater show ive tried this but only the names are displayed and the avaters dont show

Link to comment
https://forums.phpfreaks.com/topic/209264-friend-image-kinda-linking-database/
Share on other sites

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.