Welcome Guest, Not a member yet? Register   Sign In
Update multiple rows with where condition
#1

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.
Reply
#2

Read the user guide to know how to use the Model update() method:
https://codeigniter.com/user_guide/model...tml#update
Reply




Theme © iAndrew 2016 - Forum software by © MyBB