小草 发表于 2012-8-24 16:47:15

ci更新字段+1怎么写

$this->db()->update('pp_bbs_new', array('fans' => `fans` + 1 ), "uid IN ({$uids})");

这些是错的,该怎么写呢?我要把fans加1

Oh,MyGod。 发表于 2012-8-24 17:03:26

本帖最后由 Oh,MyGod。 于 2012-8-24 17:05 编辑

, "uid IN ({$uids})"
把这个去掉就可以了

lamtin 发表于 2012-8-24 17:25:21


$this->db->set('field', 'field+1', FALSE);


http://codeigniter.org.cn/user_guide/database/active_record.html

看手册啊亲~
页: [1]
查看完整版本: ci更新字段+1怎么写