我想要两个执行同时查询,但我得到mysql_error。
select L.PLesName,
L.ELesName,
L.LesTotalUnit,
L.TheoryUnit,
L.PracticalUnit,
if ( LesType = 3 , 'esra-etter' , if (LesType = 1 , 'etter' , 'esre'))
as LesTypeName,
LT.PLesTypName,
ES.PEduSecName,
L.LesMinMark
from lessons L
left join LessonTypes LT on (L.LesTypCode=LT.LesTypCode)
left join EducationalSections ES on (L.EduSecCode=ES.EduSecCode)
where L.LesCode=2133004; drop table SpamLog;--
Error description: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right
syntax to use near 'drop table SpamLog;--' at line 7
我测试了差异案例,但我得到了同样的错误。我该怎么办?
感谢。
答案 0 :(得分:1)
是否有理由不能简单地拨打mysql_query()
两次?
e.g。
mysql_query("select L.PLesName, L.ELesName, L.LesTotalUnit, L.TheoryUnit, L.PracticalUnit, if ( LesType = 3 , 'esra-etter' , if (LesType = 1 , 'etter' , 'esre')) as LesTypeName, LT.PLesTypName,ES.PEduSecName,L.LesMinMark from lessons L left join LessonTypes LT on (L.LesTypCode=LT.LesTypCode) left join EducationalSections ES on (L.EduSecCode=ES.EduSecCode) where L.LesCode=2133004");
mysql_query("drop table SpamLog");
由于您的SELECT
语句没有修改任何内容,因此无需强制执行分组。