HOW TO MAKE ADD FREND FUNCTION??
SLEDY CREATE IT AND WORK FINE ..
I JUST GOT SOME PROBLEM IN PROFILE ...
TO SHOW
ADD AS BUDDY
DELETE AS BUDDY
REQUEST SENT..
I DONT KNOW HOW TO MSKE IT ...
..
THIS CODE NOT WORK IN PROFILE
FUNCTION
CALLED IN PROFILE.PHP
any other way??
pliss help me
SLEDY CREATE IT AND WORK FINE ..
I JUST GOT SOME PROBLEM IN PROFILE ...
TO SHOW
ADD AS BUDDY
DELETE AS BUDDY
REQUEST SENT..
I DONT KNOW HOW TO MSKE IT ...
..
THIS CODE NOT WORK IN PROFILE
FUNCTION
PHP Code:
function budres($u, $w){
//3 = can't bud
//2 = already buds
//1 = request pended
//0 = can bud
if($u==$w){
return 3;
}
if(arebuds($u, $w)){
return 2;
}
$req = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM buddies WHERE ((user='".$u."' AND who='".$w."') OR (user='".$w."' AND who='".$u."')) AND agreed='0'"));
if($req[0]>0){
return 1;
}
$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM buddies WHERE (user='".$w."' OR who='".$w."') AND agreed='1'"));
if($notb[0]>=300){
return 3;
}
$notb = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM buddies WHERE (user='".$u."' OR who='".$u."') AND agreed='1'"));
if($notb[0]>=300){
return 3;
}
return 0;
}
CALLED IN PROFILE.PHP
PHP Code:
if(budres($u, $w)==0){
echo "<a href=\"$path?asp=profile&w=$w&do=1\">Add as Friend</a><br />";
}else if(budres($u, $w)==1){
echo "Request sent<br />";
}else if(budres($u, $w)==2){
echo "<a href=\"$path?asp=profile&w=$w&do=2\">Delete Friend</a><br />";
}
any other way??
pliss help me