Can an UPDATE clause in MYSQL using PHP update multiple records in a single query?
Ok, I have this message table with values ββlike these:
msg_id recipient_id read locked new
0 1 N Y Y
2 1 Y N N
ok so let's just say this is a message table and I want to reset all messages addressed to the recipient with id = 1
I was wondering why
UPDATE `messages` SET `new`='Y',`read`='N',`locked`='N' where `recipient_id`=1;
doesn't work, MYSQL always returns 0 affected rows ... can anyone help me?
for robert gamble: yes i'm pretty sure the values ββhave changed since my goal for this update request is to reset the data i used for the testing steps: D
0
lock
source
to share
1 answer
It has floating single quotes in it. You can assign one line to another or whatever.
You can just say
UPDATE messages
SET new = 'y', read = 'N', locked = 'N'
WHERE recipient_id = 1
+4
dkretz
source
to share