I am trying to do something as described in the post below, I have simplified this with a basic python program, not using flask, just to prove my concept, but I'm having some issues.
flask_mysqldb Delete FROM variable table
My code is as follows;
import mysql.connector as mariadb
new = 'ksk'
mariadb_connection = mariadb.connect(user='root', password='mypwd',
database='customers')
cursor = mariadb_connection.cursor()
cursor.execute("DELETE FROM customer_info WHERE name = %s" % (new))
mariadb_connection.commit()
print('its gone')
this throws up an error saying in my table,
"unknown column 'ksk' in where clause"
this isn't true I can see a row where the name is ksk.
Furthermore to prove this, if I change my delete statement to:
cursor.execute("DELETE FROM customer_info WHERE name = 'ksk'
the row ksk gets successfully deleted. Where am I going wrong?