当我想点击详细信息时出现此错误:
您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本,以便使用正确的语法 接近'和sq.testid = 5),0)作为学生的om作为s,测试为t,subject as sub,studentstes'在第1行
$result=executeQuery("select s.stdname,s.nume_student,s.prenume_student,
t.testname, t.testdesc,sub.subname,sub.subdesc,sub.an,
DATE_FORMAT(st.starttime,'%d %M %Y ') as stime,
DATE_FORMAT(st.starttime,' %H:%i:%s') as stimes,
TIMEDIFF(st.endtime,st.starttime) as dur,
(select sum(marks)
from question
where testid=".$_REQUEST['details'].") as tm,
IFNULL((select sum(q.marks)
from studentquestion as sq, question as q
where sq.testid=q.testid and sq.qnid=q.qnid
and sq.answered='answered' and sq.stdanswer=q.correctanswer
and sq.stdid=".$_REQUEST['stdid']."
and sq.testid=".$_REQUEST['details']."),0) as om
from student as s,test as t, subject as sub,studenttest as st
where s.stdid=st.stdid and st.testid=t.testid
and t.subid=sub.subid and st.stdid=".$_REQUEST['stdid']."
and st.testid=".$_REQUEST['details'].";") ;
我知道问题是sq.stdid=".$_REQUEST['stdid']."
和st.stdid=".$_REQUEST['stdid']."
,但我不知道如何解决它。
答案 0 :(得分:0)
调试的典型方法是打印出生成的查询。
从我所看到的(以及你得到的错误信息)看来似乎在这里:
nd sq.testid=".$_REQUEST['details']."),0) as om
)
之前的结束,0)
似乎是错误的。