2013-04-19 187 views
-3
Notice: 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 '=IF(K2>0,"7","5"),'PNW Arms',152,'data/Products Pictures/pnwpic300blkhnt125btip2' at line 1 
Error No: 1064 
INSERT INTO `product` (`product_id`,`quantity`,`sku`,`upc`,`ean`,`jan`,`isbn`,`mpn`,`location`,`stock_status_id`,`model`,`manufacturer_id`,`image`,`shipping`,`price`,`points`,`date_added`,`date_modified`,`date_available`,`weight`,`weight_class_id`,`status`,`tax_class_id`,`viewed`,`length`,`width`,`height`,`length_class_id`,`sort_order`,`subtract`,`minimum`) VALUES (1,5,'93579','855118002572','','','83964','300BLKHNT125BTIP20','',=IF(K2>0,"7","5"),'PNW Arms',152,'data/Products Pictures/pnwpic300blkhnt125btip20.jpg',1,23.3625,0,NOW(),NOW(),NOW(),0.8,5,0,11,0,5,2.625,1.5,'3','1','0','1'); in /hermes/bosweb26a/b1700/ipg.athetralcom/Athetral/system/database/mysql.php on line 49 

我想在opencart管理面板中導入excel表。只有當我在我的Excel表格中放入公式時纔會出現此錯誤。我嘗試沒有公式,並導入Excel表,它的工作,但沒有與公式。請幫我找出這個錯誤的根本原因。另外,我是excel工作表中大約40k產品的一個dropshipper。當我嘗試用40k產品同時上傳excel表格時,它不會給我任何錯誤,並且我得到空白頁面(沒有任何上傳或發生)。請讓我知道從哪個文件出現此錯誤,以便我可以修復它。請給我你的建議。錯誤號:1064雖然上傳excel表

+0

這是什麼'= IF(K2> 0, 「7」, 「5」)'價值?什麼是'K2'?它是一列嗎?我從來沒有見過這樣一個INSERT INTO值......這並不意味着它不能工作,但至少我對開始處的'K2'和'='符號很好奇...... – shadyyx

+0

嘗試刪除= IF之前聲明。 –

+0

btw這是mysql錯誤,所以把mysql標籤。我沒有看到這個錯誤與opencart有什麼關係? –

回答

0

嘗試編輯查詢(插入值),使其看起來像這樣(您不必像我一樣使用斷線,我只是爲了更好地識別) - 注意我在具體值後面添加的註釋以便改變:

INSERT INTO `product` 
    (`product_id` 
    ,`quantity` 
    ,`sku` 
    ,`upc` 
    ,`ean` 
    ,`jan` 
    ,`isbn` 
    ,`mpn` 
    ,`location` 
    ,`stock_status_id` 
    ,`model` 
    ,`manufacturer_id` 
    ,`image` 
    ,`shipping` 
    ,`price` 
    ,`points` 
    ,`date_added` 
    ,`date_modified` 
    ,`date_available` 
    ,`weight` 
    ,`weight_class_id` 
    ,`status` 
    ,`tax_class_id` 
    ,`viewed` 
    ,`length` 
    ,`width` 
    ,`height` 
    ,`length_class_id` 
    ,`sort_order` 
    ,`subtract` 
    ,`minimum`) 
VALUES 
    (1 
    ,5 
    ,'93579' 
    ,'855118002572' 
    ,'' 
    ,'' 
    ,'83964' 
    ,'300BLKHNT125BTIP20' 
    ,'' 
    ,IF(K2 > 0, '7', '5') /* <-- THIS VALUE CHANGED */ 
    ,'PNW Arms' 
    ,152 
    ,'data/Products Pictures/pnwpic300blkhnt125btip20.jpg' 
    ,1 
    ,23.3625 
    ,0 
    ,NOW() 
    ,NOW() 
    ,NOW() 
    ,0.8 
    ,5 
    ,0 
    ,11 
    ,0 
    ,5 
    ,2.625 
    ,1.5 
    ,'3' 
    ,'1' 
    ,'0' 
    ,'1') 

但我依然很好奇這是什麼K2值 - 請問product表包含這樣的列???

0

這個IF語句將在K2中作爲列ID工作,但在涉及到SQL時沒有任何意義。

難道你不能複製粘貼公式在Excel中的值然後嘗試上傳文件?


如果你喜歡這個答案,請訪問我們的網站http://punegrocery.in

+0

如果你想保留公式,則用MySQL表中的列名替換K2。 – satya