将python中的值保存到mysql db

eoxn13cs  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(311)

嘿,伙计们,我在尝试将值保存到mysql db时出错了。这是我的密码。

db = MySQLdb.connect(host="localhost", user="root", passwd="developer", db="recaptcha")

cur.execute("SELECT * FROM `captcha_response`")

cur.execute("INSERT into captcha_response(id, response) values (%s, %s)" % (0, token))

这是我的错误。

raise errorclass, errorvalue
OperationalError: (1054, "Unknown column '03ACgFB9t_ZvEFuHACU8HebuQ6zrFe_k0n9SLsoJU5GC3tm' in 'field list'")

这里是mysql数据库信息。

my database name is: "recaptcha"
    my table name is: "captcha_response"
    Example of where the items get stored
                          id                           response

Edit Copy Delete          1                            03ACgFB9uxJ...

这是我table的图像

6g8kf2rb

6g8kf2rb1#

答案就在这里!谢谢大家的帮助!

db = MySQLdb.connect(host="localhost", user="root", passwd="developer", db="recaptcha")

cur.execute("SELECT * FROM `captcha_response`")

cur.execute("INSERT into captcha_response(id, response) values (%s, %s)", (0, token))

db.commit()

相关问题