thinkphp icon indicating copy to clipboard operation
thinkphp copied to clipboard

where条件 时间字符串 :0 会被误认

Open chenjiabin opened this issue 8 years ago • 0 comments

用时间做为判断条件的话

$time = date('Y-m-d H:i:s', time() ); // 2016-12-02 15:04:53 D('Works')->where( array('created_at'=> array( 'elt', $time) ) )->save(array('status'=>-1));

string(19) "2016-12-02 15:04:53" UPDATE yy_works SET status='-1' WHERE created_at <= '2016-12-02 15'-1'4:53'

如果时间时分秒 中有:0 那么:0 会被认为 mysql的绑定 :0 执行错误的SQL

chenjiabin avatar Dec 02 '16 07:12 chenjiabin