这是我写的代码
def edititem():
edit_code = int(input("Enter the product code of the item you would like to edit:"))
edit_cat = input("Enter the category of the item you would like to edit:")
edit_val = int(input("Enter the new value"))
edit = """UPDATE products SET %s = %s where prod_code = %s"""
cur.execute(edit,(edit_cat,edit_val,edit_code,))
connector.commit()
这是我得到的错误:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' prod_code' = 1 where prod_code = 1231' at line 1
我一直无法弄清楚错误到底是什么,这将是一个很大的帮助。提前致谢。
喵喔喔
相关分类