comnd = ("UPDATE booking SET check_out_time = " (datetime.now().strftime("%H:%M")) " WHERE Contact_no = " str(contact_number_en.get())
)
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 ':00 WHERE Contact_no = 9827355876' at line 1
How can I do this to make a single query of SQL ?
CodePudding user response:
You should be using a prepared statement here, e.g.
sql = "UPDATE booking SET check_out_time = %s WHERE Contact_no = %s"
vals = (datetime.now(), contact_number_en.get())
cursor.execute(sql, vals)
