2012-09-02 30 views
0

错误codigniter下面的代码给我一个错误,更新数组:笨批量更新引发了指数

$query="UPDATE sell_rate SET price='$price' WHERE code='$code'"; 
       $this->db->query($query); 

的错误是:

您必须指定一个索引来匹配上批更新

请帮我解决这个问题。

+0

我对codeigniter没有任何线索,但我会说你必须提供更多信息。 – fancyPants

+0

[在Codeigniter中更新多行]的可能的重复(http://stackoverflow.com/questions/12238941/updating-multiple-rows-in-codeigniter) –

+0

db-> update_batch()方法的此错误上升,而不是db - > query().. – Aurel

回答

0

尝试此代码

$ options = array('price'=> $ price);
$ this-> db-> where('code',$ code);
$ this-> db-> update('sell_rate',$ options);