sql注入在%s占位符的字典传参,示例代码:import pyMysqldb = pymysql.connect(host="119.XX.XX.XX",port=3306,user="XXXXXXXX",passwd="XXXXXXXXX
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()
--结束END--
本文标题: SQL注入在哪里传递参数值
本文链接: https://www.lsjlt.com/news/115266.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
2024-04-26
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0