简体   繁体   English

数据库错误:MySQL错误号:1064

[英]Database Error: MySQL Error Number: 1064

I can't for the life of me figure out what the issue here is, maybe another pair of eyes may help: 我一生无法弄清这里的问题所在,也许另一双眼睛可能会有所帮助:

Here is the error message: 这是错误消息:

Error Number: 1064

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 '://www.amazon.com/Lemon-Recipes-Alkalizing-Addition-Delectable-ebook/dp/B00CZTCS' at line 1

INSERT INTO `books` (`asin`, `keyword_id`, `page_count`, `sales_rank`, `price`, `link`) VALUES (B00CZTCS9K, 1, 77, 96317, 2.25, http://www.amazon.com/Lemon-Recipes-Alkalizing-Addition-Delectable-ebook/dp/B00CZTCS9K%3FSubscriptionId%3DAKIAJPNAWJHXGB5IYXOA%26tag%3Dgenroad-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00CZTCS9K)

As M Khalid Junaid mentioned you will need to wrap string in a single quote. 正如M Khalid Junaid所说,您需要将字符串用单引号引起来。 That means both 'B00CZTCS9K' and the link 'http://....' should be wrapped. 这意味着应同时包装'B00CZTCS9K'和链接'http://....'

The rest look like decimals but, if any other value is a string(varchar) than wrap it also. 其余的看起来像小数,但是,如果还有其他值是一个字符串(varchar),那么也要包装它。

Try this, Added ' quotes for asin and link column values those are strings. 尝试此操作,为asin and link列值添加'引号,它们是字符串。 String are need to be wrapped around quotes. 字符串需要用引号引起来。

  INSERT INTO `books` (`asin`, `keyword_id`, `page_count`, `sales_rank`, `price`, `link`) 
  VALUES ('B00CZTCS9K', 1, 77, 96317, '2.25', 'http://www.amazon.com/Lemon-Recipes-Alkalizing-Addition-Delectable-ebook/dp/B00CZTCS9K%3FSubscriptionId%3DAKIAJPNAWJHXGB5IYXOA%26tag%3Dgenroad-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00CZTCS9K')

You need to put quotes around all strings, including URLs: 您需要在所有字符串(包括URL)周围加上引号:

INSERT INTO `books` (`asin`, `keyword_id`, `page_count`, `sales_rank`, `price`, `link`) 
VALUES ('B00CZTCS9K', 1, 77, 96317, '2.25', 'http://www.amazon.com/Lemon-Recipes-Alkalizing-Addition-Delectable-ebook/dp/B00CZTCS9K%3FSubscriptionId%3DAKIAJPNAWJHXGB5IYXOA%26tag%3Dgenroad-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB00CZTCS9K')

Otherwise, mySQL will throw an error because it tries to parse the text as a column or mySQL construct. 否则,mySQL将引发错误,因为它试图将文本解析为列或mySQL构造。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM