Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Friends feed application

Guest
Feb 03, 2011 Feb 03, 2011

Hi Guys

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

{

}

TOPICS
Server side applications
564
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Feb 03, 2011 Feb 03, 2011

bregent wrote:

Seems like you've asked this before.

The duplicate post can be seen here:

http://forums.adobe.com/thread/771787

Translate
LEGEND ,
Feb 03, 2011 Feb 03, 2011

Seems like you've asked this before. Do you really have more than one database you are querying? Are they both on the same host? You should not need to execute multiple queries inside loops. Just do a simple SQL join in a single select statement. Is there a reason you are not doing it this way?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 03, 2011 Feb 03, 2011

Thank you for the reply.

I have been trying to fix the problem for a month now but no luck.

Some tests tell me that after I query the first database the $friendid variable that I use to query the second status table is all the ids of the users friends. The only problem is that their not seperated instead represent a single number . I am not able to query the second status database as a result.

I desperately need help. If you know any way I could solve this please let me know.

I tried a join but no success. I could not get while loop array for the status data of the users friends from the status table.

Thanks again for the reply.....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 03, 2011 Feb 03, 2011

bregent wrote:

Seems like you've asked this before.

The duplicate post can be seen here:

http://forums.adobe.com/thread/771787

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 03, 2011 Feb 03, 2011
LATEST

can you help?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines