I have a table named tablename with idno as primary kry. I want the row to be deleted if the user specifies the idno in the table. Here are my codes:
data3=raw_input("Enter the idno to del :",)
mydata=cursor.execute("DELETE FROM tablename where idno=%d", data3)
db.commit()
I'm getting this error:
Traceback (most recent call last): File "C:\Python27\trertr.py", line 50, in mydata=cursor.execute("DELETE FROM tablename where idno=%d", data3) File "C:\Python27\lib\site-packages\MySQLdb\cursors.py", line 187, in execute query = query % tuple([db.literal(item) for item in args]) TypeError: %d format: a number is required, not str
After a lot of tries, I have got the answer which worked for me