CodeIgniter Forums
Cannot execute query update with multiple rows - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Cannot execute query update with multiple rows (/showthread.php?tid=79169)



Cannot execute query update with multiple rows - sfarzoso - 05-03-2021

I'm trying to update multiple rows using this code:

PHP Code:
$directoryId $this->request->getPostGet('directory_id');
        $where $this->request->getPostGet('media_ids');
        var_dump($where);
        var_dump($directoryId);
        $result $this->post->whereIn('id'$where)->update('parent'$directoryId); 

essentially $where contains this:

PHP Code:
array(2) {
  [0]=>
  string(4"1115"
  [1]=>
  string(4"1116"


and $directoryId is: 1132

I get:

PHP Code:
Return value must be of type array, string returned 



RE: Cannot execute query update with multiple rows - iRedds - 05-03-2021

"oh baby please give a little respect to ..." framework

RTFM

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