View Single Post
  #2 (permalink)  
Old 01-24-2007, 12:41 AM
bergs bergs is offline
Casual Pligger
 
Join Date: Sep 2006
Posts: 37
Thanks: 1
Thanked 1 Time in 1 Post
Figured this out!

I just created a function that counts the number of friends a user has:

function count_friends(){
global $db, $user;
$friends = "SELECT count(*) FROM " . table_friends . " INNER JOIN " . table_users . " ON " . table_friends . ".friend_from = " . table_users . ".user_id WHERE (((" . table_friends . ".friend_to)= " . $user->id . ")) ;";
$count=$db->get_var($friends);
echo $count;
}
Reply With Quote
The Following User Says Thank You to bergs For This Useful Post: