亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

更新Mysql中的行

更新Mysql中的行

森林海 2021-03-16 15:14:08
我正在嘗試更新MySQL DB中的數據,但它拋出錯誤:UPDATE scrapedDataTable  SET productDesc=,                             moreProductImages=full/545521_1363869251%20copy-500x500.jpg,full/545521_1363869251%20copy-275x275.jpg,full/545522_1363869309%20copy-500x500.jpg,full/545522_1363869309%20copy-74x74.jpg, ,productCategory=Clothing,                             productSubCategory=NA  WHERE Server=http://1click1call.com/Jeans-Shirts-Tshirts-Trousers/W-for-Woman-Kurta-54552And error:(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 'moreProductImages=full/545521_1363869251%20copy-500x500.jpg,full/545521_13638692' at line 1")"(<class '_mysql_exceptions.ProgrammingError'>)"我的表結構是:+--------------------+---------------+------+-----+---------+-------+| Field              | Type          | Null | Key | Default | Extra |+--------------------+---------------+------+-----+---------+-------+| productTitle       | varchar(100)  | NO   |     | NULL    |       || productSite        | varchar(1000) | NO   |     | NULL    |       || productDesc        | text          | YES  |     | NULL    |       || productURL         | varchar(325)  | NO   | PRI | NULL    |       || productMRP         | varchar(200)  | YES  |     | NULL    |       || productPrice       | varchar(200)  | YES  |     | NULL    |       || productCategory    | varchar(50)   | YES  |     | NULL    |       || productSubCategory | varchar(50)   | YES  |     | NULL    |       || imageURL           | text          | YES  |     | NULL    |       || moreProductImages  | text          | YES  |     | NULL    |       |+--------------------+---------------+------+-----+---------+-------+詢問 :cursor.execute("UPDATE scrapedDataTable  SET productDesc=%s,moreProductImages='%s', ,productCategory=%s, productSubCategory=%s  WHERE productURL=%s" %(productDesc,image_paths,productCategory,productSubCategory,productURL))誰能幫我...
查看完整描述

2 回答

?
jeck貓

TA貢獻1909條經驗 獲得超7個贊

由所有Python SQL庫實現的Python數據庫API使用已參數化的查詢-本手冊中沒有涉及到PHP中常見的無用的參數廢話轉義。您需要%s在查詢中的s周圍舍棄單引號,而不是使用%運算符手動(且容易注入)將參數格式化為查詢格式,而%用逗號替換,以將參數作為第二個參數傳遞給execute()

查看完整回答
反對 回復 2021-03-27
  • 2 回答
  • 0 關注
  • 215 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號