gpt4 book ai didi

php - "Error in your SQL syntax; check the manual that corresponds to your MySQL server version"PHP 时间比较问题

转载 作者:行者123 更新时间:2023-11-29 17:29:04 27 4
gpt4 key购买 nike

每次我尝试格式化 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));

郑重声明,我已尝试将排队日期转换为字符串和日期时间值,但仍然收到错误。

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)

关于php - "Error in your SQL syntax; check the manual that corresponds to your MySQL server version"PHP 时间比较问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50790676/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com