为什么这段代码......
$curr_time = new DateTime();
$query_inprocess = "UPDATE `MyTable`
SET inprocess=1
WHERE startTime <= '" .$curr_time->format('Y-m-d H:i') . "'";
...导致SQL查询不正确,忽略<
之后的语句?
UPDATE `MyTable` SET inprocess=1 WHERE startTime <
答案 0 :(得分:1)
找到以下一个:
"UPDATE `MyTable` SET inprocess=1 WHERE startTime <= now()"
它可以帮助您获得所需的确切结果。
答案 1 :(得分:0)
试试这个
$curr_time = new DateTime();
$query_inprocess = "UPDATE `MyTable`
SET inprocess=1
WHERE startTime <='" .$curr_time->format('Y-m-d H:i'). "'";//OR use date('Y-m-d H:i') instead of $curr_time->format('Y-m-d H:i')