我使用 Python,我得到一个“不正确的整数值:'(2L,)' for column 'id' at row 1”
这就是我所做的:
for user in users:
userID = self.selectQuery("SELECT COUNT(id) FROM user;")
self.changeQuery("INSERT INTO user VALUES ('" + str(userID[0]) + "', '" + str(user) + "','','');")
def changeQuery (self, query):
connection = MySQLdb.connect(self.mysql_host, self.mysql_user, self.mysql_password, self.mysql_db)
cursor = connection.cursor()
cursor.execute (query)
connection.commit()
cursor.close()
connection.close()