与AND NOT EXISTS PHP MySQL的问题

时间:2014-07-31 16:48:04

标签: php mysql mysqli moodle

我的php代码有问题,试图使用' AND NOT EXISTS没有运气。

我正在开发一个学生管理系统,以整合到Moodle eLearning软件中,并试图生成一个查询,当用户没有登录48小时后触发自动发送电子邮件#39; t完成了课程。

课程结束是“课程模式”' 45''

只是有一些麻烦产生你的查询。或者是否有更简单的方法来排除行?

收到错误Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /var/www/smp.bolt.net.au/test.php on line 40

  

$result = $mysqli->query(" SELECT mdl_course_modules_completion.coursemoduleid, mdl_course_modules_completion.completionstate, mdl_course_modules_completion.timemodified, sis_students.altID, sis_students.ID, sis_students.firstname, sis_students.secondname, sis_students.lastname, sis_students.email, sis_students.consultantid, mdl_user.currentlogin FROM sis_students Inner Join mdl_user On sis_students.altID = mdl_user.idnumber Inner Join mdl_course_modules_completion On mdl_user.id = mdl_course_modules_completion.userid WHERE mdl_course_modules_completion.completionstate = '1' AND mdl_user.currentlogin >= ( UNIX_TIMESTAMP( ) -60000000)
AND NOT EXISTS ( Select mdl_course_modules_completion.coursemoduleid, mdl_course_modules_completion.completionstate, mdl_course_modules_completion.timemodified, sis_students.altID, sis_students.ID, sis_students.firstname, sis_students.secondname, sis_students.lastname, sis_students.email, sis_students.consultantid, mdl_user.currentlogin FROM sis_students Inner Join mdl_user On sis_students.altID = mdl_user.idnumber Inner Join mdl_course_modules_completion On mdl_user.id = mdl_course_modules_completion.userid WHERE mdl_course_modules_completion.coursemoduleid = '45' mdl_course_modules_completion.completionstate = '1' ) GROUP BY sis_students.ID"); while($row = mysqli_fetch_array($result))

0 个答案:

没有答案