用惯了TP5,在使用TP3的过程中有一些坑.
setinc不抛出异常,ppid和currency3均为不存在字段
① 不抛出异常
M('member')->where('ppid', 1600)->setInc('currency3', 200); |
M('member')->where('ppid', 1600)->setInc('currency3', 200);
②抛出异常
M('member')->where('ppid', 1600)->find(); |
M('member')->where('ppid', 1600)->find();
+++++++++++++++++++++++++++++++++++++++
$user = M('member')->where(array('id'=>$userId))->find();
对应sql语句
SELECT * FROM `tk_member` WHERE `id` = 28135 LIMIT 1 |
$user = M('member')->where(array('id'=>$userId))->find();
对应sql语句
SELECT * FROM `tk_member` WHERE `id` = 28135 LIMIT 1
$user= M('member')->where('id',1000)->find();
对应sql语句
SELECT * FROM `tk_member` WHERE ( id ) LIMIT 1 |
$user= M('member')->where('id',1000)->find();
对应sql语句
SELECT * FROM `tk_member` WHERE ( id ) LIMIT 1
$user = M('member')->where('id='.$userId)->find();
对应sql语句
SELECT * FROM `tk_member` WHERE ( id=28135 ) LIMIT 1 |
$user = M('member')->where('id='.$userId)->find();
对应sql语句
SELECT * FROM `tk_member` WHERE ( id=28135 ) LIMIT 1