Pymysql没有更新表格

时间:2017-03-28 12:37:29

标签: python-3.x

我不知道什么是错的

def update_user(self, user_id, key, value):
    con = self.connection.create_connection()
    cur = con.cursor()
    cur.execute("UPDATE users SET " + key + " = %s WHERE id = %s", [value, user_id])
    con.commit()
    con.close()
    cur.close()

DaoManager.user_dao.update_user(session.habbo.id," machine_id",msg.read_string())

DaoManager:

user_dao = None

try:
    user_dao = UserDao(Database())
except Exception as e:
    Logging.error("Error caught (" + __file__  + "): " + str(e))

数据库:

def create_connection(self):
    return pymysql.connect(user="root", password="", host="localhost", database="")

用户表未更新,因此我不知道。

0 个答案:

没有答案