當我嘗試運行該代碼時,出現以下錯誤:您的SQL語法錯誤;檢查對應於你的MySQL服務器版本的手冊,在第一行使用正確的語法''''PHP - Mysql語法錯誤
我不知道什麼是問題,有人可以幫助我嗎?
CODE:
<?php include_once("includes/head.php"); ?>
<?php require_once("includes/connect/connect.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php require_once("includes/jquery.php"); ?>
<?php function friend_request_notification(){
global $db;
global $userid;
$userid = $_SESSION['userid'];
$query_id_see = "SELECT user_id FROM friend_requests WHERE user_id={$userid}";
$result_set3 = mysql_query($query_id_see, $db) or die(mysql_error());
$insert_table = "INSERT INTO friend_requests_notificated (id, user_id, user_id_requester)";
$change_table2 = mysql_query($insert_table) or die(mysql_error());
$select_table = "SELECT id, user_id, user_id_requester FROM friend_requests WHERE user_id={$userid}";
$change_table1 = mysql_query($select_table) or die(mysql_error());
if ($id_requests = mysql_fetch_array($result_set3)){
if ($id_requests2 = mysql_fetch_array($change_table2))
{
}
if ($id_requests1 = mysql_fetch_array($change_table1))
{
}
}
else
{
}
}
friend_request_notification();
?>
您的INSERT查詢沒有任何值,只是字段 – nickhar
用準備好的語句切換到PDO並且所有的麻煩都會消失 –
$ insert_table ....插入什麼?我看不到你在那裏插入東西。 – Twisted1919