views:

64

answers:

3
INSERT INTO `tims`.`pending_profile`(`id`, `nickname`, `location`, `role`, `yog`, `interests`, `favMoment`, `gainThisYr`, `futurePlans`, `bio`) 
VALUES ('1', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE ( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1',gainThisYr= '1',futurePlans= '1',bio= '1')

What is triggering this 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 '( nickname ='1', location= '1', role= '1',yog= '1',interests= '1',favMoment= '1'' at line 3

+4  A: 

Put comma's between the fields:

INSERT INTO tims.pending_profile
  (id, nickname, location, role, yog, interests, favMoment, gainThisYr, futurePlans, bio) 
VALUES
  ('', '1', '1', '1', '', '1', '1', '1', '1', '1')
ON DUPLICATE KEY UPDATE nickname ='1', location= '1', role= '1', yog= '1', interests= '1', favMoment= '1', gainThisYr= '1', futurePlans= '1', bio= '1'
Lekensteyn
The closing parenthesis has no matching opening parenthesis.
TP
+1: Yes, the query is missing the commas between the fields in the `ON DUPLICATE KEY UPDATE`
OMG Ponies
@TP: True, that will turn up as another 1064 error *after* the commas are added, so I addressed it when I edited the answer for formatting.
OMG Ponies
Finally got the formatting right :) shouldn't you use NULL instead of '' on id?
Lekensteyn
Cheeky, *very* cheeky... :p
OMG Ponies
+1  A: 

You never opened your parentheses and you need commas between the fields

ON DUPLICATE KEY UPDATE **(**nickname ='1', location= '1', role= '1', yog= '1', interests= '1', favMoment= '1', gainThisYr= '1', futurePlans= '1', bio= '1')     
Ben
The brackets aren't necessary, per the documentation: http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
OMG Ponies
+1  A: 

Should you not use commas to separate your list of columns to update on the last line?

David