2014-12-07 45 views
-2

我想這我如何在MySQL數據庫中插入值?

INSERT INTO db. `shops` (`ShopId`,​ `ItemCategory`,​ `ShopBitmask`,​ `ItemId`,​ `Buyable`) 
VALUES (457,​ 'weapon',​ 2,​ 5562,​ 1); 
INSERT INTO db. `shops` (`ShopId`,​ `ItemCategory`,​ `ShopBitmask`,​ `ItemId`,​ `Buyable`) 
VALUES (457,​ 'weapon',​ 6,​ 5592,​ 1); 

但它說:「你有你的SQL語法錯誤」。列商店存在於數據庫數據庫中。

錯誤

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 '`ItemCategory`,​ `ShopBitmask`,​ `ItemId`,​ `Buyable`) 
VALUES (457,​ 'we' at line 1 
+2

什麼時候人們會在出現明確錯誤時開始查看文檔? – arkascha 2014-12-07 17:19:10

+0

爲什麼你在其他地方再次提出同樣的問題?這是不允許在這個網站上 – 2014-12-07 17:59:13

回答

0

這裏刪除空格:

INSERT INTO db. `shops` ... 

修改成:

INSERT INTO db.shops ... 
0

從您的列名,表名和數據庫之間的空間刪除反引號。

1

「db」之間有額外的空間。和「``店......」 - 讓您的backtips,他們避免柱子和MySQL的關鍵字之間的混淆

1

(舉例名爲date列)嘗試這樣

INSERT INTO db.shops (ShopId,​ ItemCategory,​ ShopBitmask,​ ItemId,​ Buyable) 
VALUES (457,​ 'weapon',​ 2,​ 5562,​ 1), 
VALUES (457,​ 'weapon',​ 6,​ 5592,​ 1); 

db. shops和之間沒有空格沒有`字符。當你試圖插入乘法值構建像上面的查詢。