Matslom
5854
21
Laravel

Update multiple rows using Query Builder (1 query)

Posted 3 years ago by Matslom

Hello, it is possible to update multiple rows in 1 query? I tried something like this

$where['page_id'] = [1,2,3];
$update = [['column' => 'value1'],['column' => 'value2']];
DB::table('my_table')->where($where)->update($update);

but only what I get was Parameter mismatch, pattern is a string while replacement is an array error.

Thanks.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.