I'm having issues deleting rows from my database with python. I can hard code it like this:
del_student = "DELETE FROM students WHERE sid=34556"
cursor.execute(del_student)
cnx.commit()
but I'm trying to get sid from my entry box in my gui and this isn't working:
sid=SIDEnt.get()
del_student = "DELETE FROM students WHERE sid=%s"
cursor.execute(del_student,sid)
cnx.commit()
I'm rather new to python and I've tried looking through the posted questions already, thanks.
print(repr(sid))after thesid=SIDEnt.get()line ?sid, I believe that you need to use?as a placeholder rather than%s.%sis the correct paramstyle.