好的,我已经被困在我的网站上2天了吗?我的问题是,当一个用户说出鲍勃并且他进入账单资料而他们不是朋友时会显示添加为朋友图片?
问题:
如果他们不是朋友,如何拍照?
到目前为止我的代码是......
$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;
}
}
}
答案 0 :(得分:2)
我不知道$lolz['accepted']
的含义是什么。所以,我的代码是最好的猜测。
$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.";
}
答案 1 :(得分:-1)
我宁愿拒绝,因为代码有语法错误 - if是IF