OperationalError
sqlite3.OperationalError: no such column: ceica
This is the error message that I receive when I try to delete a row from my databse Note: I already have implemented functions for adding, searching in tables and worked perfectly fine
HTML button:
{% for row in rows %}
<p>
<b>Nume: </b>{{row[1]}} {{row[2]}}, <b>Varsta: </b>{{row[3]}} <br>
<b>Telefon: </b>{{row[4]}}, <b>Localitate:</b>{{row[5]}}, <b>E-mail: </b>{{row[6]}}
<button type="button" class="close"><a href="/stergere/pacient/{{row[1]}}">X</a></button>
</p>
<hr>
{% endfor %}
Python function:
@auth.route('/stergere/<tabel>/<element>')
def stergereInTabel(tabel,element):
connection=sqlite3.connect('database.db')
cursor=connection.cursor()
if tabel=='pacient':
#print("DELETE FROM ? WHERE nume=?",(tabel,str(element),))
#cursor.execute("DELETE FROM ? WHERE nume=?",(tabel,str(element),))
print("DELETE FROM {} WHERE nume={x}".format(tabel,x=element))
cursor.execute("DELETE FROM {} WHERE nume={x}".format(tabel,x=element))
return render_template("{}.html".format(tabel),user=current_user)
I tried every combination possible with converting element to string, using .format for both parameters, using tuple method for both but none worked.