我想从表中更新model_quantity列值,而我的数组是::
$data['update_models'][$i]= array( 'model_quantity'=>'`model_quantity`-'.$_POST['quantity_row_'.$i], 'model_name'=>addslashes($_POST['model_row_'.$i]), ); $this->db->update_batch('table_name',$data,'model_name');
Update_Batch无效我将最后执行的查询作为
UPDATE `model` SET `model_quantity` = CASE WHEN `model_name` = 'Road 100x250 5\\\"' THEN '`model_quantity`-2' WHEN `model_name` = 'Road 100x250 5\\\"' THEN '`model_quantity`-1' ELSE `model_quantity` END WHERE `model_name` IN ('Road 100x250 5\\\"','Road 100x250 5\\\"')
数组为
$data = Array ( [0] => Array ( [model_quantity] =>model_quantity
-2 [model_name] => Road 100x250 5\" )[1] => Array ( [model_quantity] => `model_quantity`-1 [model_name] => Road 100x250 5\" )
)