dsk61780
dsk61780
2014-01-12 08:30

数据库错误:MySQL错误号: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)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

3条回答

  • dta38159 dta38159 7年前

    As M Khalid Junaid mentioned you will need to wrap string in a single quote. That means both 'B00CZTCS9K' and the link 'http://....' should be wrapped.

    The rest look like decimals but, if any other value is a string(varchar) than wrap it also.

    点赞 评论 复制链接分享
  • dongshun7312 dongshun7312 7年前

    You need to put quotes around all strings, including URLs:

    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.

    点赞 评论 复制链接分享
  • dosf40815 dosf40815 7年前

    Try this, Added ' quotes for asin and link column values those are strings. 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')
    
    点赞 评论 复制链接分享

相关推荐