I am trying to update my values and something weird is happening, MySQL seems to be updating rows out of its own free will. Here is what I do
UPDATE accountsTable SET Status = 'TerminatedProfile' WHERE id IN (1,2,3)
And it updates either one or two rows not all 3, even if I run the code multiple times. And if I take this query and run it through phpmyadmin it works fine. Is there something wrong with php's mysql implementation or what?
I am using
mysql_connect("$host", "$user", "$password")or die("cannot connect");
mysql_select_db("$db")or die("cannot select DB");
mysql_query($query2);
Update: I was running it on Joomla and perhaps it had something to do with session because one of the rows I was trying to update was on the admin user I was logged in with. Thanks for the responses specially MikeB.
It's difficult to know what is going on without the full code or where $query2 has being applied.
But you can try to update these rows not using a list. Try:
UPDATE accountsTable SET Status = 'TerminatedProfile' WHERE id = 1 AND id = 2 AND id = 3
It's just to make sure the problem is or not where $query2 is.
You can also try to run this query right on mysql console, and see what happens. If works, probably the error is in how you're doing it.