Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL query giving error 1064 - any ideas?

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?

like image 916
ed22 Avatar asked Apr 27 '11 18:04

ed22


People also ask

What is error code 1064 in MySQL workbench?

MySQL Error codes Error code 1064: Syntax error Getting a "1064 error" message from MySQL means the query cannot be parsed without syntax errors. In other words it can't make sense of the query.

What is no database selected error in MySQL?

MySQL no database selected is an error that occurs when you execute a statement without first selecting a database. The database may be completely missing, or you may choose the wrong database if there is more than one database.


1 Answers

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
like image 177
Nicola Cossu Avatar answered Sep 29 '22 00:09

Nicola Cossu