开发者

database are these two friends?

开发者 https://www.devze.com 2023-03-08 09:23 出处:网络
Ok I have been stuck on my website for like 2 days with this? My question is When a user say bob and he goes on bills Profile and they are not friends it will show a add as a friend picture?

Ok I have been stuck on my website for like 2 days with this? My question is When a user say bob and he goes on bills Profile and they are not friends it will show a add as a friend picture?

Question:

How to make a picture pop up if they are not friends?

My code so far is...

$recqu = $_SESSION['username'];
$sql747 = mysql_query("SELECT * 
                      FROM Friends 
                      WHERE Reciver LIKE '%$recqu%' or Sender LIKE '%$recqu%'"); 
$areFriends = mysql_num_rows($sql747);

IF ($areFriends ==0)
{
    $_SERVER['PHP_SELF']开发者_StackOverflow;
}
else
{
    while ($lolz = mysql_fetch_array($sql747))
    {
        if ($lolz['accepted'] == 3)
        {
           $yes = 2;
        }
        else
        {
           $yes = 1;
        }
    }
} 


I don't know what the meaning of $lolz['accepted'] are. So, my code below is by best guess.

$recqu = $_SESSION['username'];
$sql747 = mysql_query("select * from Friends where Reciver like '%$recqu%' or Sender like '%$recqu%'"); 
$areFriends = mysql_num_rows($sql747);

if ($areFriends ==0)
{
    $yes = 0;
}
else
{
    while ($lolz = mysql_fetch_array($sql747))
    {
        if ($lolz['accepted'] == 3)
        {
            $yes = 2;
        }
        else
        {
            $yes = 1;
        }
    }
}

if( 0 == $yes )
{
   echo "<a href='add_friend.php?your=param&here'><img src='/img/add_frienf.jpg' alt='add friend' /></a>";
}
else if(1 == $yes)
{
   echo "you've already send friend request.";
}
else if(2 == $yes)
{
   echo "you're already friend.";
}


I'd rather say no, because the code has syntax errors - the if is IF

0

精彩评论

暂无评论...
验证码 换一张
取 消