您好我的SQL代码有问题而且我不知道原因是什么。以下是我的代码:
//Sanitize the POST values
$appdate = clean($con, $_POST['appdate']);
$apptime = clean($con, $_POST['apptime']);
$topic = clean($con, $_POST['topic']);
$evaluation = clean($con, $_POST['evaluation']);
$counselor = clean($con, $_POST['counselor']);
$desc = clean($con, $_POST['desc']);
$sql="INSERT INTO appointment VALUES(NULL, '$memid', '$counselor', '$appdate', '$apptime', '$topic', '$evaluation', '$desc', 'Pending')";
$test=mysqli_query($con, $sql);
//Check whether the query was successful or not
if($test) {
header("location: main.php?page=appointments");
exit();
} else {
echo "Query failed.";
exit();
}
问题是,我只能将1个数据只插入表中。下一个数据无法插入表格中,它将显示"查询失败"。这对我来说很困惑。有人可以帮助我。
p / s:抱歉语法错误/英语