Welcome Guest, Not a member yet? Register   Sign In
Update using WHERE
#5

(01-11-2022, 02:47 PM)iRedds Wrote: https://codeigniter.com/user_guide/model...aving-data

Thanks, but again nothing on there explains my situation.

Closest thing is this:

PHP Code:
$userModel
    
->whereIn('id', [1,2,3])
    ->
set(['active' => 1])
    ->
update(); 

Where you can set multiple rows, but you have to pass all the ids in.

In my situation I would have to query the db for all the rows where activity_id = X
Then convert that to an array of the ids and then do the above query.

Thanks though.
Reply


Messages In This Thread
Update using WHERE - by sevmusic - 01-11-2022, 01:37 PM
RE: Update using WHERE - by BilltheCat - 01-11-2022, 01:43 PM
RE: Update using WHERE - by sevmusic - 01-11-2022, 02:13 PM
RE: Update using WHERE - by iRedds - 01-11-2022, 02:47 PM
RE: Update using WHERE - by sevmusic - 01-11-2022, 03:47 PM
RE: Update using WHERE - by BilltheCat - 01-11-2022, 08:06 PM
RE: Update using WHERE - by sevmusic - 01-14-2022, 07:52 AM
RE: Update using WHERE - by kenjis - 01-14-2022, 05:09 PM
RE: Update using WHERE - by sevmusic - 01-20-2022, 08:02 AM
RE: Update using WHERE - by BilltheCat - 01-20-2022, 08:38 AM
RE: Update using WHERE - by sevmusic - 01-20-2022, 01:20 PM
RE: Update using WHERE - by demyr - 01-20-2022, 11:53 AM
RE: Update using WHERE - by demyr - 01-20-2022, 02:10 PM
RE: Update using WHERE - by kenjis - 01-20-2022, 06:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB