Skip to content
Advertisement

How to update all rows where id is in array?

I have an array with some numbers in it, 34, 12 and 23 for example.

Now I want to update all database rows where the id is in the array (when the id is 34, 12 and 23).

How do I accomplish this?

Any help would be appreciated.

Advertisement

Answer

In SQL you can filter WHERE with array by using>

JavaScript

So you have to implode your array to string separated by commas. Something like this:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement