php - 分析错误:语法错误:意外的'}'

  显示原文与译文双语对照的内容
0 0

Having 一个小问题,标题中的错误,但所有括号都匹配,这样我不知道为什么它显示这个错误。 谁知道为什么?

代码是:


<?php

 session_start();
 require_once 'db/connect.php';
//require_once 'entryformsuccess.php';
 echo $_SESSION['Username']. ' logged in successfully '. ' <br> ';

 if ($student_delete = $con->query("SELECT Student.Form, Teacher.Form, Forename, Surname, Student_ID, Username". 
"FROM student, teacher". 
"WHERE Student.Form = Teacher.Form AND Teacher.Username = '". $_SESSION['Username']."'")) {

 if (isset($_POST['Student_ID'])) { 
 $checkbox = $_POST['checkbox']; 

 for ($i=0;$i<count($checkbox);$i++) {
 $del_student = $checkbox[$i];
 $query= $con->query("DELETE FROM users WHERE Student_ID = 'Student_ID'")


 } 

 }
 } 

?>

时间: 原作者:

0 0

你错过了最后的;


$query= $con->query("DELETE FROM users WHERE Student_ID = 'Student_ID'")

原作者:
0 0

请更新它。


<?php

 session_start();
 require_once 'db/connect.php';
//require_once 'entryformsuccess.php';
 echo $_SESSION['Username']. ' logged in successfully '. ' <br> ';

 if ($student_delete = $con->query("SELECT Student.Form, Teacher.Form, Forename, Surname, Student_ID, Username". 
"FROM student, teacher". 
"WHERE Student.Form = Teacher.Form AND Teacher.Username = '". $_SESSION['Username']."'")) {

 if (isset($_POST['Student_ID'])) { 
 $checkbox = $_POST['checkbox']; 

 for ($i=0;$i<count($checkbox);$i++) {
 $del_student = $checkbox[$i];
 $query= $con->query("DELETE FROM users WHERE Student_ID = 'Student_ID'");


 } 

 }
 } 

?>

原作者:
0 0

我认为此行末尾缺少一个分号:


$query= $con->query("DELETE FROM users WHERE Student_ID = 'Student_ID'");

原作者:
...