Skip to content Skip to sidebar Skip to footer

Flask_mysqldb Delete From Variable Table

So i use flask_mysqldb in a Flask(Python website) I'm trying to write a function to delete a row in any table. It works perfectly when I hardcode the tablename, but what do I need

Solution 1:

cur.execute("DELETE FROM %s WHERE id = %s", (table, id))

should be

cur.execute("DELETE FROM %s WHERE id = %s" % (table, id))

Post a Comment for "Flask_mysqldb Delete From Variable Table"