我想写基本的友谊脚本。但有一个问题。虽然我的数据库表上没有数据,但它接受is_approved
column = 0
虽然我的 MySQL 数据库上没有数据,但它会打印“ request pending
”为什么?
编辑
$per = $db->query("SELECT * FROM permission WHERE user_id = " . $profile_owner_id . "");
$per->setFetchMode(PDO::FETCH_ASSOC);
$per_dat = $per->fetch(); //
//FETCH friendship table // THERE IS NO DATA in friendship table
$friend_request = $db->query("SELECT * FROM friendship WHERE sender_id = ".$_SESSION['SES_USER_ID']." AND receiver_id=".$profile_owner_id."");
$friend_request->setFetchMode(PDO::FETCH_ASSOC);
$fr_data = $friend_request->fetch(); //
if ( $_SESSION["SES_USER_ID"] != $profile_owner_id ) {
if($per_dat["get_friendship_request"] == 1) {
if($fr_data["is_approved"] ==1){
echo "Allready friend";
}
else if($fr_data["is_approved"]==0){
echo "request pending";
}
else{
echo "Send friend request.";
}
}
else{
echo "He/she does not accept friend requests..";
}