CodeIgniter Forums
trying to use batch_update() - 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: trying to use batch_update() (/showthread.php?tid=77175)

Pages: 1 2


RE: trying to use batch_update() - ojmichael - 08-03-2020

Here it looks like you wrote a SELECT query, did not utilize the result, and then wrote a separate UPDATE query with no conditions.

I think you're wanting to do something like this..

PHP Code:
$this->db
    
->set(['in_population' => 1])
    ->
where('email'$_SESSION['userid'])
    ->
where('campaign'$_SESSION['campaign'])
    ->
group_start()
        ->where('employee_title',  $exclude_string)
        ->or_where('job_code',  $exclude_string)
        ->or_where('department',  $exclude_string)
        ->or_where('role',  $exclude_string)
    ->
group_end()
    ->
update('employees'); 



RE: trying to use batch_update() - richb201 - 08-03-2020

Works great! thank you.