每次我尝试格式化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"周围。

任何建议就是建议,不胜感激。

最佳答案

尝试这个

SELECT * FROM employee1
WHERE (employee1.starttime BETWEEN $appointmentDateTime AND $endDateTime )
OR ($appointmentDateTime BETWEEN employee1.starttime AND employee1.endtime)

09-29 22:48