I have such a code Python:
conn.execute(("UPDATE instagram SET description_photo =? WHERE id="),self.inputDescriptionInstagram,self.idPhoto)
an error pops up: conn.execute(("UPDATE instagram SET description_photo =? WHERE id=?"),self.inputDescriptionInstagram,self.idPhoto) TypeError: function takes at most 2 arguments (3 given)
what am I doing wrong, where is the mistake?
self.inputDescriptionInstagram,self.idPhoto to the data transferred using the to definition button. All code is located in the class.
CodePudding user response:
You also missed '?' after id=
There should be 2 arguments, 1st sql query , 2nd the parameters I think you should try
conn.execute("UPDATE instagram SET description_photo =? WHERE id=?", (self.inputDescriptionInstagram,self.idPhoto))
or you can also do like this
conn.execute("UPDATE instagram SET description_photo =" self.inputDescriptionInstagram " WHERE id= " self.idPhoto )