我有以下查询...我将如何解决为什么它没有加载任何数据(我与我的数据库的连接很好)。
$filename = "/data/101Phones-Product_Catalog_TXT.txt";
mysql_query('load data infile "'.$filename.'" into table CJProducts fields terminated by "\t" lines terminated by "\n" (PROGRAMNAME, PROGRAMNAME, CATALOGNAME, LASTUPDATED, NAME, KEYWORDS, DESCRIPTION, SKU, MANUFACTURER, MANUFACTURERID, UPC, ISBN, CURRENCY, SALEPRICE, PRICE, RETAILPRICE, FROMPRICE, BUYURL, IMPRESSIONURL, IMAGEURL, ADVERTISERCATEGORY, THIRDPARTYID, THIRDPARTYCATEGORY, AUTHOR, ARTIST, TITLE, PUBLISHER, LABEL, FORMAT, SPECIAL, GIFT, PROMOTIONALTEXT, STARTDATE, ENDDATE, OFFLINE, ONLINE, INSTOCK, CONDITION, WARRANTY, STANDARDSHIPPINGCOST)');
http://billsprice.com/1_800_FLORALS-Product_Catalog_1.txt
编辑:
mysql> load data infile "/data/101Phones-Product_Catalog_TXT.txt" into table CJProducts fields terminated by "\t" lines terminated by "\n" (`PROGRAMNAME`, `PROGRAMURL`, `CATALOGNAME`, `LASTUPDATED`, `NAME`, `KEYWORDS`, `DESCRIPTION`, `SKU`, `MANUFACTURER`, `MANUFACTURERID`, `UPC`, `ISBN`, `CURRENCY`, `SALEPRICE`, `PRICE`, `RETAILPRICE`, `FROMPRICE`, `BUYURL`, `IMPRESSIONURL`, `IMAGEUR`, `ADVERTISERCATEGORY`, `THIRDPARTYID`, `THIRDPARTYCATEGORY`, `AUTHOR`, `ARTIST`, `TITLE`, `PUBLISHER`, `LABEL`, `FORMAT`, `SPECIAL`, `GIFT`, `PROMOTIONALTEXT`, `STARTDATE`, `ENDDATE`, `OFFLINE`, `ONLINE`, `INSTOCK`, `CONDITION`, `WARRANTY`, `STANDARDSHIPPINGCOST` SHOW ERRORS
答案 0 :(得分:1)
使用SHOW ERRORS
和SHOW WARNINGS
获取明确的消息。
或者,尝试在mysql控制台中执行此请求以获取更多信息。
尝试检查此答案:Can I detect and handle MySQL Warnings with PHP?。
同样反引用您的列名称,例如,CONDITION
是保留关键字。修改您的查询,如下所示:
mysql_query('load data infile "'.$filename.'" into table CJProducts fields terminated by "\t" lines terminated by "\n" (`PROGRAMNAME`, `PROGRAMNAME`, `CATALOGNAME`, `LASTUPDATED`, `NAME`, `KEYWORDS`, `DESCRIPTION`, `SKU`, `MANUFACTURER`, `MANUFACTURERID`, `UPC`, `ISBN`, `CURRENCY`, `SALEPRICE`, `PRICE`, `RETAILPRICE`, `FROMPRICE`, `BUYURL`, `IMPRESSIONURL`, `IMAGEUR`, `ADVERTISERCATEGORY`, `THIRDPARTYID`, `THIRDPARTYCATEGORY`, `AUTHOR`, `ARTIST`, `TITLE`, `PUBLISHER`, `LABEL`, `FORMAT`, `SPECIAL`, `GIFT`, `PROMOTIONALTEXT`, `STARTDATE`, `ENDDATE`, `OFFLINE`, `ONLINE`, `INSTOCK`, `CONDITION`, `WARRANTY`, `STANDARDSHIPPINGCOST`)');
最后,您已经写了PROGRAMNAME
两次。这是正常的吗?