This seems to be a really simple query, but somehow I keep getting errors...
Basically, I just got a bunch of information from a user, and now I'm going to update their record in the users
table in one query:
UPDATE users
SET timezone
= 'America/New_York', SET updates
= 'NO', SET verified
= 'YES' WHERE id
= '1'
However, after running that, I get the following error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET updates
= 'NO', SET verified
= 'YES' WHERE id
= '1'' at line 1".
Any help is much appreciated.
UPDATE users SET timezone = 'America/New_York', updates = 'NO', verified = 'YES' WHERE id = '1'
Your update syntax is wrong, you have to write syntax SET just once.
UPDATE users SET col1= value1, col2= value2, col3= value3 WHERE condition;
More information about update UPDATE MANUAL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With