code:
def update(self):
if self.var_contact.get()=="":
messagebox.showerror("Error","Contact cannot be empty",parent=self.root)
else:
conn=mysql.connector.connect(host="localhost",username="root",password="krish@123",database="face_monitoring")
mycursor=conn.cursor()
mycursor.execute("update room set Checkindate=%s,Checkoutdate=%s,Room type=%s,Room available=%s,Meals=%s,Duration of suite=%s where Contact=%s",(
self.var_checkin.get(),
self.var_checkout.get(),
self.var_roomtype.get(),
self.var_roomavailable.get(),
self.var_meal.get(),
self.var_duration.get(),
self.var_contact.get()
))
conn.commit()
self.fetch_data()
conn.close()
messagebox.showinfo("Update","Room details has been updated successfully",parent=self.root)
error:
mysql.connector.errors.ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type='Deluxe',Room available='2002',Meals='10',Duration of suite='3' where Conta' at line 1