Page 1 of 1
Friendscheck
Posted: Thu May 10, 2012 8:10 pm
by Huezzer
Hey, I've got problem, I can't get it work as I want. I want a friendspage that shows the friends that you have added. And next to their names, I want it to show their onlinestatus, that means I have made some icons that I want to show up next to their names to show the status, if they are online, if they are offline etc.
Thanks, Huezzer
Re: Friendscheck
Posted: Thu May 10, 2012 10:01 pm
by SpiritWebb
Try looking at
http://www.developphp.com and look under the PHP section...scroll to the bottom to the social network tutorial, he teaches how to do the add friends...
Re: Friendscheck
Posted: Fri May 11, 2012 7:01 am
by Foofighter
Re: Friendscheck
Posted: Fri May 11, 2012 7:07 pm
by vitinho444
Not sure what to add to help you, but if you cant make it work with the previous replies then try to make:
//inside the while loop that catches all your friends or whatever you are using
if($friend_online)
{
echo $name . " <img src='online.png'>";
}
else
{
echo $name . " <img src='offline.png'>";
}
not sure if that's what you are asking :S
Re: Friendscheck
Posted: Wed May 16, 2012 5:20 pm
by Torniquet
I agree with Spirit, definitely use that site as a starting point.
I have however produced a slightly cleaner method of retrieving the names of the users.
$query = "SELECT `user_id`, `username`, `username_clean` FROM `user_data` WHERE `user_id` IN ({$user->friends_list})";
If I remember rightly when he lists the names, he explodes the string and performs a query for every user id within the array. If you store your friends ids in a comma delimited list (which I believe is the way shown in those tutorials), the IN function will do the same thing in one query.
Just a small FYI for you and anyone who may need it
![Smile :)](./images/smilies/icon_e_smile.gif)