5

This query:

UPDATE jos_content SET fulltext='\r\n<br /> \" some other text' WHERE id=3

gives:

ERROR 1064 (42000): 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 'fulltext='\r\n<br /> \" some other text' WHERE id=3' at line 1

Anyone has any idea why?

6
  • Is it a typo here that you are missing a ; at the end of the query?
    – Mahesh
    Apr 27, 2011 at 18:29
  • trailing semicolons aren't required for single queries. Only if you were doing multiple queries would you need ; to separate them, and MySQL doesn't allow multiple queries in a single query call.
    – Marc B
    Apr 27, 2011 at 18:31
  • @Raj, please do not edit the code. If there's an error in there that relates to the question, you've just obscured the error and confused everybody
    – Johan
    Apr 27, 2011 at 18:35
  • 1
    @Johan Please check the edit history before you post comments. My edit was to format the code, not change it. You were the one to actually add a new line and edit the code.
    – Raj More
    Apr 27, 2011 at 19:45
  • @ray did look at the orig post, but must have misread sorry sorry 1000x sorry
    – Johan
    Apr 27, 2011 at 20:29

1 Answer 1

11

fulltext is a reserved word.

http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

rename your field or put it within backticks '`' (alt + 96)

like so:

UPDATE jos_content SET `fulltext`='\r\n<br /> \" some other text' WHERE id=3
1
  • Alt+96 depends on the keyboard layout and operating system. My keyboard doesn't even have an Alt-key.
    – user142019
    Apr 27, 2011 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.