
[英]Error "check the manual that corresponds to your MySQL server version for the right syntax to use near on SQL LIKE" on php
[英]“Error in your SQL syntax; check the manual that corresponds to your MySQL server version” PHP Issues with Time Comparison
每次我尝试格式化php MySQLi查询时,都会不断出现格式化错误,告诉我要检查手册-尽管我不确定这到底有什么问题。
$timeCheckEmp1 = "SELECT * FROM employee1
WHERE employee1.starttime BETWEEN $appointmentDateTime AND $endDateTime
OR $appointmentDateTime BETWEEN employee1.starttime AND employee1.endtime"
$getResultEmp1 = mysqli_query($link, $timeCheckEmp1) or die(mysqli_error($link));
为了进行记录,我尝试将排队的日期转换为字符串和dateTime值,但仍然出现错误。
PHP服务器给我的唯一帮助是,它发生在"AND ($endDateTime value) OR (appointmentDateTime value) BETWEEN employee1.starttime AND employee1.endtime"
。
任何建议就是建议,不胜感激。
我认为$ appointmentDateTime和$ endDateTime应该被引用。
$timeCheckEmp1 = "SELECT * FROM employee1 WHERE employee1.starttime BETWEEN '$appointmentDateTime' AND '$endDateTime' OR '$appointmentDateTime' BETWEEN employee1.starttime AND employee1.endtime";
尝试这个
SELECT * FROM employee1
WHERE (employee1.starttime BETWEEN $appointmentDateTime AND $endDateTime )
OR ($appointmentDateTime BETWEEN employee1.starttime AND employee1.endtime)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.