这是mysql查询:

$data = "SELECT course_name, studentAttendance.course_course_code
FROM login, course, staff, studentAttendance
WHERE studentAttendance.staff_staff_id = staff.staff_id
AND studentAttendance.course_course_code = course.course_code
AND staff.login_login_id = login.login_id
AND login.login_id = $_SESSION['login_user']
GROUP BY studentAttendance.course_course_code";


该错误据说是:

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE),
expecting identifier (T_STRING) or variable (T_VARIABLE) or number
(T_NUM_STRING) in C:\wamp\www\attendance_system\dashboard-lecturer.php on line 267

最佳答案

使用以下查询,

"SELECT course_name, studentAttendance.course_course_code FROM login, course, staff, studentAttendance
WHERE studentAttendance.staff_staff_id = staff.staff_id
AND studentAttendance.course_course_code = course.course_code
AND staff.login_login_id = login.login_id
AND login.login_id = '".$_SESSION['login_user']."'
GROUP BY studentAttendance.course_course_code";

10-01 20:36