从变量值中减去字段值的正确语法是什么?更新字段从变量中减去
例子:
field1 = 100
variable1 = 10
我想用笨的活动记录
从字段1减去变量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
这是正确的?因为我得到错误的结果。
确保接受的答案。 – Aaron 2012-04-17 12:33:51
是的。我会。谢谢 – Jetoox 2012-04-17 12:50:26