2012-09-02 29 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);