Error updating multiple MySQL columns

This seems to be a really simple request, but somehow I get errors all the time ...

Basically, I just got a bunch of information from the user, and now I'm going to update their record in the table usersin one query:

UPDATE usersSET timezone= 'America / New_York', SET updates= 'NO', SET verified= 'YES' WHERE id= '1'

However, after executing this error, I get the following error: "You have an error in the SQL syntax, check the manual that matches the version of your MySQL server for the correct syntax to use next to" SET updates= "NO", SET verified= "YES" WHERE id= ' 1 '' on line 1 ".

Any help is greatly appreciated.

+5
source share
3 answers
UPDATE users SET timezone = 'America/New_York', updates = 'NO', verified = 'YES' WHERE id = '1'
+9
source

The update syntax is incorrect, you only need to write the SET syntax once.

UPDATE users SET col1= value1, col2= value2, col3= value3 WHERE condition;

Additional Update Information MANUAL UPDATE

+4
source

The set should be used once no matter how many columns you update. Your request will be: -

Users UPDATE SET timezone = 'America / New_York', updates = 'NO', verified = 'YES' WHERE id = '1'

0
source

All Articles