Cannot use column name "desc" in mysql

INSERT INTO movie (id, title, desc, released, views, featured) VALUES ('', 'title', '
\r\n    description
\r\n', '2006-12-12', '0', '0')

error

1064 - You have an error in the SQL syntax; check the manual corresponding to the version of MySQL server to use the syntax correctly near 'desc, release, views, featured) VALUES (' ',' title ',' \ r \ n description \ r \ n ',' on line 1

Table structure

id [ (pk, auto_inc) int(11) ]
title [ varchar(256) ]
desc [ text ]
released [ date ]
views [ int(11) ]
featured [ int(11) ]

works in phpmyadmin sql editor

+5
source share
3 answers

desc is the reserved word mysql . you should use backticks `` with columns that are reserved words.

INSERT INTO movie (id, title, `desc`, released, views, featured)...

(``)

+11

desc .

INSERT INTO movie (id, title, `desc`, released, views, featured) VALUES
-- ...etc...

desc , . , description, .

+4

DESC - MySQL, , `desc`.

+3

All Articles