从变量值中减去字段值的正确语法是什么?
Example:
field1 = 100
variable1 = 10
我想使用 codeigniter 的活动记录从 field1 中减去变量 1
我当前的代码如下所示:
$this->db->set('volume', 'volume'-$r['quantity'], FALSE)
->where('code',$r['ingredient_id'])
->update('tbl_ingredients');
volume is the field
$r['quantity] is the variable
它是否正确?因为我得到了错误的结果。
Try this
$this->db->set('volume', 'volume-'.$r['quantity'], FALSE)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)