using two databases and using info to produce friends list
Posted: Sat May 09, 2009 10:31 am
so i have a friends table and a status table. what would be the best way to use both tables and get info from both of them to only show the status of your friends.
ex. on facebook you can see peoples "status" BUT only your friends "status" not some random guy,
thats what i'm trying to get at
here's my starting code (which shows EVERY status)
i do have start session at the top of my page (so i can use the SESSION variable)
but from here on I don't really know what to do, I know i'll probably have to use the "else" statment but either then that, don't know what to do.
Any help would be appreciated,
thanks in advance, kedora19
ex. on facebook you can see peoples "status" BUT only your friends "status" not some random guy,
thats what i'm trying to get at
here's my starting code (which shows EVERY status)
Code: Select all
<?php
include '../login/dbc.php';
//first open connection to your database
$takeuser = mysql_query("SELECT * FROM userstatus");
$takeuser2 = mysql_query("SELECT * FROM users");
while ($row=mysql_fetch_array($takeuser)) { //Taking the result set
echo '<font color="#ff8538">' . $row['username'] . '</font>'. ': ' . $row['message'] . '<br />';
echo $row['time'] . $row['date'] . '<br /><br />' ;
} //closing the loop
mysql_close($link); //and then we close connection
?>
but from here on I don't really know what to do, I know i'll probably have to use the "else" statment but either then that, don't know what to do.
Any help would be appreciated,
thanks in advance, kedora19