INSERT INTO movie (id, title, desc, released, views, featured) VALUES ('', 'title', '
\r\n description
\r\n', '2006-12-12', '0', '0')
错误是
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 'desc, released, views, featured) VALUES ('', 'title', ' \r\n description \r\n', ' at line 1
表结构为
id [ (pk, auto_inc) int(11) ]
title [ varchar(256) ]
desc [ text ]
released [ date ]
views [ int(11) ]
featured [ int(11) ]
在 phpmyadmin sql 编辑器中运行
最佳答案
desc 是一个 mysql reserved word .您必须对保留字列使用反引号 ``。
INSERT INTO movie (id, title, `desc`, released, views, featured)...
你应该避免使用保留字作为列名或者必须使用反引号(``)
关于php - 无法在 mysql 中使用列名 "desc",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8200174/