Hi Guys
http://www.phpfreaks.com/forums/Smileys/nrg_alpha/cool.gif
Cool
I have social networking application. I am trying to query a database to get the ids of all the users friends. With the ids of all the users friends I am then trying to query a second database with the status feed that contains all users status data.
I would like to echo the users friends status data only from the second database
code is below hope you can help.
Thank you.
<?Php
session_start();
?>
<?Php
//connect.
include("connect.php");
//Time ago coverting code.
include_once("classes/develop_php_library.php"); // Include the class library
$id=$_SESSION['id'];
/*find-out users friends*/
$findperson=mysql_query("SELECT * FROM friends WHERE sessid='$id'");
$timeAgoObject = new convertToAgo; // Create an object for the time conversion functions
$findfriend=mysql_num_rows($findperson);
//Count if the person has any friends. If they have friends get the ids of all their friends
if($findfriend>0)
{
while($rati=mysql_fetch_assoc($findperson))
{
$fried=$rati['friendid'];
//query the status table to give the users friends status.
$mediafeeds=mysql_query("SELECT * FROM status WHERE userid='$fried' LIMIT 0,8");
$media_num=mysql_num_rows($mediafeeds);
}
//count to see if their any status updates from users friends.
if($media_num>0)
{
//display all the users friends status data.
$datamedia="<TABLE BORDER='0' CELLPADDING=8 bgcolor='#FFFFFF' align='center' width='350px' height='30px'>";
while($mini=mysql_fetch_assoc($mediafeeds))
{
$user_id=$mini['userid'];
$viewer_nme=$mini['username'];
$viewer_picture=$mini['viewerpics'];
$media_pic=$mini['contentpic'];
$desc_ption=$mini['description'];
$date_time=$mini['date'];
$convertedTime = ($timeAgoObject -> convert_datetime($datetime)); // Convert Date Time
$datetime = ($timeAgoObject -> makeAgo($convertedTime)); // Then convert to ago time
..
//This is just a table with the data of all the users friends data.
$datamedia.="<tr><td valign='top' cellpadding='5' width='10%' bgcolor='#FFFFFF' align='center' >$viewer_nme<br/><a href='friendsprofile.php?uid=$uidd&&viewer=$id'><img src='".$mediapic."' width='80' height='80' align=left></td>
<td valign='top' align='left' cellpadding='5' width='60%' bgcolor='#D3D3D3' cellpadding='0'>$introduction<br/>$titlenamed$titled<br/>$descd$desc_ ption<br/><br/>$datetime</td></tr>";
}
$datamedia.="</TABLE>";
echo $datamedia;
}
else
{
echo "<font color='#333333' size='2' face='sans-serif' align=left><div align='center'> Your friends have not current activities.</div></font>";
}
}
else
{
}