Thinkphp 框架计算一个字段等于另外两个字段之和

原sql写法:

update table set a=a+b where id=1;

TP框架写法:

$where = $setData = array();
$where['id']    = 1;
$setData['a']   = array('exp', 'a+b');
M('table')->where($where)->save($setData);

 

你可能感兴趣的:(TP,PHP)