我运行代码时遇到此错误,两个更新都单独工作
更新记录时出错:您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便在“更新申请人”附近使用正确的语法SET courseid =' 1'姓氏=' Leiva''在第5行
<?php
include('check.php');
include ('connection2.php');
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "UPDATE courses
SET availability=availability-1, enrolled=enrolled+1
WHERE courseID='1';
UPDATE applicants SET courseid='1' WHERE surname='$user_check'";
if ($conn->query($sql) === TRUE) {
header('Location: youroffers2.php');
}
else {
echo "Error updating record: " . $conn->error;
}
$conn->close();
?>