-
this is proving tougher than i thought! i have tried allsorts but nothing is working.
this is what i have now:
PHP Code:
if ($fris['friendname'] != $req_user_info['username']){ //checks if user isnt a friend
echo "<a href=\"friendrequest.php?user=".$req_user_info['username']."\" title=\"Become Friends With ".$req_user_info['username']."\"><img src=\"friends_icon.png\" width=\"25\" height=\"25\" border=\"0\" /></a><br>";
}
else{
echo "[<font color='#666666'>You are friends</font>]";
}
problem with this is, it echoes 'you are friends' with one of my friends, and the option to add as friend with the rest of my friends. its like the query isnt selecting all from table but query looks ok, here it is:
PHP Code:
$get = mysql_query( 'SELECT * FROM `friends` WHERE `username` = \''.$username.'\''); //gets friends
$fris = mysql_fetch_array($get);
anybody got any ideas?
-
-
i tried echoing $fris and $fris['friendname'] and both no results. all i want to do is select all the friend name column from table friends where the session username is in column 'username'
-
i dunno if this is anything to do with it, but i am trying to achieve this within an existing else thingy
-
no worries guys, i finally sussed it
now i have this:
PHP Code:
$getFriends = mysql_query("SELECT * FROM `friends` WHERE `friendname` = \"".$req_user_info['username']."\" AND `username` = \"".$session->username."\"");
if (mysql_num_rows($getFriends) == 0){
echo "<a href=\"friendrequest.php?user=".$req_user_info['username']."\" title=\"Become Friends With ".$req_user_info['username']."\"><img src=\"friends_icon.png\" width=\"25\" height=\"25\" border=\"0\" /></a><br>";
}
else {
echo ( "<br>[<font color='#666666'>You are friends</font>]<br>");
}
thanx for all your help anyway