Multiple UPDATES vs. One UPDATE??
My website has a Private Message center which works in a manner very similar to how Yahoo Mail works.
When a User views his/her Inbox, next to each Message is a check-box.
By checking certain Messages in the Inbox, then choosing an "action" (e.g. Mark as Unread) and then "Go", the script will update the Messages accordingly.
Now on to my question...
So currently, when the user submits the Form, I store all Messages that he/she checked in an Array. From there, I LOOP through the Array values, and run a separate UPDATE query for each Message that was chosen.
Would it be better to eliminate the ForEach Loop, and somehow run a SINGLE UPDATE query??
From my research online, some people say one UPDATE is better, and yet others say multiple UPDATES are better?!
What are the Pros and Cons of each approach?
Also, if eliminating my Loop and having one query is the way to go, how exactly would I take all of the Messages in my Array and stick them in One Query?? :-/