关于CI的数据库update
各位大侠,小弟求助ing直接写sql中可以写 update table set p_num = p_num+3 where id=1000
用CI周末写p_num=p_num+3啊
大侠们,紧急求助啊跪求解法,先取出p_num加3再update就不用说了
使用$this->db->query(sql)的方式不支持数据表的前缀,这样改了数据表的前缀还得改sql. ->db->set('p_num','p_num+3',false); 楼上能在具体点吗?
我是太明白用法 $this->db->set('p_num','p_num+3',false); 我的代码是
$this->db->set('show', 'show+1', FALSE);
$this->db->where('id', $id);
$this->db->update($this->_table_name);
但是页面报错了
Error Number: 1064You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show = show+1 WHERE `id` = '1'' at line 1UPDATE `link` SET show = show+1 WHERE `id` = '1'Filename: D:/www/sscms/application/models/link_m.phpLine Number: 14
页:
[1]