2013-01-21 52 views
1

嗨,我得到这个错误,这是我的查询MySQL的错误行1 INSERT INTO]

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:\网络\ filesearch \的index.php你有一个错误你的SQL语法;检查与您的MySQL服务器版本相对应的手册,以便在'M,Eastland Plainview Shoes(Black) - Women's 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

我强烈建议您仔细阅读,以保护自己免受SQL注入攻击,并使用mysqli或PDO代替弃用的mysql_函数。 –

回答

2

行情查询中附上您的字符串值。你有很大的字符串,但他们周围没有引号,那就是错误。例如5068122-EC1155705-5.5M应该是"5068122-EC1155705-5.5M"'5068122-EC1155705-5.5M'

+0

是的,或者通过使用查询参数来避免整个问题。 –

+0

嗨,你好,谢谢你的回应,但它并没有解决我的问题..仍然存在相同的错误 – Alex

+1

,因为你必须为每个字符串值,而不仅仅是一个 –

1

对于在将它们用引号引起来后插入的值也使用mysql_escape_string。

0

让我看看代码。我会想出一些东西

+0

是的,我使用QOUTES,但它不能解决问题 – Alex

+0

@Roger这句话不正确,你也可以为FLOAT和其他数值做这样的事情 –

0

请更新与您的新查询文章。如果用QUOTES正确更新了查询,则下一个问题可能是数据类型不匹配或者字符串与定义的列之间的长度不匹配。