Skip to content
Advertisement

How do i delete a record from SQLite using “name” for example instead of id?

I have a code below which Deletes records from the database using the “email_address” when i use the Id, it deletes fine, but when i switch it to “email_address” it gives me a sqlite3.OperationalError. I have an input field which stores the data that is going to be deleted and is passed down below as “email_delete”. Does anyone know how to fix it?This is the link to the image which contains the error message

Advertisement

Answer

You need to pass the values that will replace the placeholders in your query as a second argument to c.execute(...) instead of concatenating them together with the query string:

Instead of

do

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement