The following SQl query gives me the error:
IF EXISTS (SELECT * FROM comments WHERE user_id='2' AND course_id='1')
UPDATE comments SET page1='exists' WHERE user_id='2' AND course_id='1'
ELSE
INSERT INTO comments (user_id,course_id,page1) VALUES ('2','1','inserted')
" #1064 - 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 'IF EXISTS (SELECT * FROM comments WHERE user_id='2' AND course_id='1') UPDATE co' at line 1 "
I'm sure the syntax is correct?!
INSERT....ON DUPLICATE KEY UPDATEwould be easier), or as lines within a stored procedure?