2012-10-14 89 views
1

我有一個小問題,插入一個表格,這裏是代碼:MySQL錯誤 - 插入到表

mysql_query("INSERT INTO admin_menu (id, title, type, icon, parent, url, order, append, module) VALUES('', 'powerpoint', '0', 'powerpoint.png', '0', 'powerpoint/config', '0', '0', '0') ") or die(mysql_error()); 

它給了我下面的錯誤:

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 'order, append, module) VALUES('', 'powerpoint', '0', 'powerpoint.png', '0', 'pow' at line 1

任何幫助將是很大的感謝,謝謝!

回答

7

orderreserved word。將其包裹在反引號

... url, `order`, append,... 

你也不應該使用mysql_query

Use of this extension is discouraged. Instead, the MySQLi or PDO_MySQL extension should be used.

+0

非常感謝!它現在有效! – sliceruk

3

您需要使用反引號。訂單是保留關鍵字。

mysql_query("INSERT INTO admin_menu (id, title, type, icon, parent, url, `order`, append, module) 
+0

非常感謝! – sliceruk