![]() |
Update multiple rows with where condition - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Update multiple rows with where condition (/showthread.php?tid=91546) |
Update multiple rows with where condition - sjender - 08-28-2024 Hi, I want to update all rows in the database which meet a certain condition. PHP Code: $this->vatRatesModel->update(['default', 0], ['site_id', $this->site->id]); But this doesn't work. When I open the debugbar, there is not even an UPDATE query. I want to set 'default' to 0, many of them now are 1. The 'default' field has been added to $allowedFields in the model. This works, because when I insert a record, the 'default' field is inserted as well. RE: Update multiple rows with where condition - kenjis - 08-28-2024 Read the user guide to know how to use the Model update() method: https://codeigniter.com/user_guide/models/model.html#update |