SQL注入在%s占位符的字典传参,示例代码:
import pymysql
db = pymysql.connect(host=”119.XX.XX.XX”,
port=3306,
user=”XXXXXXXX”,
passwd=”XXXXXXXXXXXXX”,
db=”XXXXXX”,
charset=’utf8′)
# %s 占位符为需要传递的参数,切记不要加”双引号,要不然会报错
sql = “SELECT totalusercount * 1.4 FROM mm_project_uv_outdoor WHERE poiid = %s AND currenttime = %s”
cursor = db.cursor()
# 以下为传递多个参数的用法
cursor.execute(sql,[‘B00140N5CS’,’2019-04-23′])
# 传递单个参数时 cursor.execute(sql,’B00140N5CS’)
print(cursor.fetchall())
db.close()
了解更多SQL注入在哪里传递参数值相关的解答,就上多想派(www.duoxiangpai.com)。
本文章由用户鲜淘网分享,版权归原作者,如侵犯,请联系(点这里联系),经核实,我们将第一时间删除。如若转载,请注明出处:https://www.duoxiangpai.com/65692.html