database are these two friends?

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'];
}
else
{
    while ($lolz = mysql_fetch_array($sql747))
    {
        if ($lolz['accepted'] == 3)
        {
           $yes = 2;
        }
        else
        {
           $yes = 1;
        }
    }
} 

Answers


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.";
}

Need Your Help

How to print out a hash that is named like a regular variable

perl

I've been thrust into supporting a perl cgi program, and I have very little functional perl experience.

Android Studio cannot find Samsung device on my Mac but works in PC

android osx adb driver

I recently got a replacement of Samsung Galaxy Note 3 with Lollipop (stock rom, no root). I used to use this device with rooted version and it worked perfectly with my Android Studio on my OSX 10.1...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.