嗨,我收到此错误,这是我的查询
insert into `products` (original_id,name,image_url,buy_url,short_description,long_description,sale_price,retail_price,brand,keyword,category_name,store_name,provider_name) values (5068122-EC1155705-5.5M,Eastland Plainview Shoes (Black) - Women's Shoes - 5.5 M,http://www.shoes.com/productimages/shoes_iaec1155705.jpg,http://gan.doubleclick.net/gan_click?lid=41000000025255752&pid=5068122-EC1155705-5.5M&adurl=http%3A%2F%2Fwww.shoes.com%2FShopping%2Fproductdetails.aspx%3Fcatalog%255Fname%3Dweb%26pg%3D5068122%26p%3DEC1155705&usg=AFHzDLv0Y4C7BN1pbi4RzmWWTgLx7J7uBw&pubid=21000000000526055,Eastland keeps it timeless and classy with these smart and sturdy Plainview oxfords. Soft full grain leather upper in a casual oxford style with a round plain toe. Contouring double stitching and an Eastland side logo tag add classic detail. Five eyelet g,Eastland keeps it timeless and classy with these smart and sturdy Plainview oxfords. Soft full grain leather upper in a casual oxford style with a round plain toe. Contouring double stitching and an Eastland side logo tag add classic detail. Five eyelet grommeted lacing and a smooth leather padded collar and tongue create a comfortable customizable fit. Textile lining and cushioning footbed flexible stitched midsole. Durable polyurethane traction outsole with a sturdy 1 1/4 inch heel.,77.00,77.00,Eastland,Eastland Plainview Shoes (Black) - Women's Shoes - 5.5 M Womens|Casual Eastland US adult Black female Apparel & Accessories > Shoes 5.5 M,Apparel & Accessories > Shoes,Eastland,gan)
那是不是错了?在线:127文件C:\ web \ filesearch \ index.php您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在'M,Eastland Plainview Shoes(黑色) - 女鞋 - 5.5 M,http://www.shoes.com/'第1行附近使用正确的语法
第一行:127是
mysql_query($query) or die($query . "<br />On line: " . __LINE__ . " File " . __FILE__ . " " . mysql_error());
答案 0 :(得分:2)
将字符串值包含在引号中以供查询。你有大字符串,但它们周围没有引号,这就是错误。例如,5068122-EC1155705-5.5M
应为"5068122-EC1155705-5.5M"
或'5068122-EC1155705-5.5M'
答案 1 :(得分:1)
也可以将mysql_escape_string用于将它们用引号括起来后插入的值。
答案 2 :(得分:0)
让我看看代码。我很快就会提出一些建议
答案 3 :(得分:0)
请使用新查询更新帖子。如果使用QUOTES正确更新了查询,则下一个问题可能是数据类型不匹配或字符串与定义的列之间的长度不匹配。