gpt4 book ai didi

python - 向mysql插入数据,使用python避免sql注入(inject)

转载 作者:行者123 更新时间:2023-11-30 21:40:41 25 4
gpt4 key购买 nike

<分区>

我哪里做错了?查询运行成功但数据库表中没有数据存储

我的代码块是

import pymysql                                                                                         
db = pymysql.connect(host='', user='', passwd='',db='')
cursor = db.cursor()
cursor.executemany("""INSERT INTO Mention ( keyword, required, optional, excluded)
VALUES (%s,%s,%s,%s)""",
[
("Spam","fg","gtg","uu") ,
("dd","fg","gtg","uu") ,
("dd","fg","gtg","uu")
])
print(cursor.fetchmany())

enter image description here

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com