Php 基于$curr\u time->;的SQL语句;格式(';Y-m-d H:i';)

Php 基于$curr\u time->;的SQL语句;格式(';Y-m-d H:i';),php,mysql,sql,Php,Mysql,Sql,为什么这个代码 $curr_time = new DateTime(); $query_inprocess = "UPDATE `MyTable` SET inprocess=1 WHERE startTime <= '" .$curr_time->format('Y-m-d H:i') . "'"; $curr_time=new DateTime(); $query\u inprocess=“更新

为什么这个代码

$curr_time = new DateTime();
$query_inprocess = "UPDATE `MyTable` 
                    SET inprocess=1 
                    WHERE startTime <= '" .$curr_time->format('Y-m-d H:i') . "'";
$curr_time=new DateTime();
$query\u inprocess=“更新`MyTable`
设置inprocess=1
在哪里开始时间试试这个

$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')
$curr_time=new DateTime();
$query\u inprocess=“更新`MyTable`
设置inprocess=1
其中startTime找到下面的一个:

"UPDATE `MyTable` SET inprocess=1 WHERE startTime <= now()"

“更新`MyTable`SET inprocess=1,其中startTime使用参数化查询并避免自己格式化数据类型。您得到的错误消息是什么?”更新'MyTable'SET inprocess=1,其中startTime对我有效:为什么空间会起作用?@YouKuper:您是否检查了php.ini文件中的
错误报告设置?也许脚本正在生成一个您没有看到的错误。
"UPDATE `MyTable` SET inprocess=1 WHERE startTime <= now()"