这是我的代码
$sql14 = ("SELECT count(`MarksID`) AS all FROM tbl_course_marks_result WHERE tbl_course_marks_result.`StudentID` = '$k' AND tbl_course_marks_result.`CourseID`='$courseID' AND tbl_course_marks_result.`SessionID`='$sessionID' AND tbl_course_marks_result.`TermID`='$termID' ");
$result14 = mysqli_query($connect,$sql14);
if($result14 === FALSE) {
die(mysqli_error($connect));
}
此处显示此错误消息"您的SQL语法有错误;检查与您的MariaDB服务器版本相对应的手册,以便在所有FROM tbl_course_marks_result附近使用正确的语法WHERE tbl_course_marks_result。StudentID
=' 17'在第1行"怎么解决这个???
答案 0 :(得分:1)
所有都是保留关键字。使用不同的别名,如下所示
$sql14 = ("SELECT count(`MarksID`) AS all_marksid FROM tbl_course_marks_result WHERE tbl_course_marks_result.`StudentID` = '$k' AND tbl_course_marks_result.`CourseID`='$courseID' AND tbl_course_marks_result.`SessionID`='$sessionID' AND tbl_course_marks_result.`TermID`='$termID' ");
$result14 = mysqli_query($connect,$sql14);
if($result14 === FALSE) {
die(mysqli_error($connect));
}