`def add_customer():
sql_command = “INSERT INTO customers (first_name, last_name, zipcode, price_paid, email, address_1, address_2, city, state, country, phone, payment_method, discount_code) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, )”
values = (first_name_box.get(), last_name_box.get(), zipcode_box.get(), price_paid_box.get(), email_box.get(), address1_box.get(), address2_box.get(), city_box.get(), state_box.get(), country_box.get(), phone_box.get(), payment_method_box.get(), discount_code_box.get())
my_cursor.execute(sql_command, values)
# commit the chages to the database
mydb.commit()
# clear fields
clear_fields()`
when i click the add customer button when i run the file it gives me this error
File "C:Python312Libtkinter__init__.py", line 1967, in __call__ return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:UsersxxxxOxxxDesktopGUI PROJECTSCRM Tool.venvcrm.py", line 77, in add_customer my_cursor.execute(sql_command, values) File "C:UsersxxxxxxxxDesktopGUI PROJECTSCRM Tool.venvLibsite-packagesmysqlconnectorcursor_cext.py", line 372, in execute result = self._cnx.cmd_query( ^^^^^^^^^^^^^^^^^^^^ File "C:UsersxxxexxxxeDesktopGUI PROJECTSCRM Tool.venvLibsite-packagesmysqlconnectoropentelemetrycontext_propagation.py", line 102, in wrapper return method(cnx, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:UsersxxxxxxxDesktopGUI PROJECTSCRM Tool.venvLibsite-packagesmysqlconnectorconnection_cext.py", line 705, in cmd_query raise get_mysql_exception( 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 ')' at line 1
I Tried to see if the code was correct. I also tried to delete sqlconnector and download it again.
garyy hoover is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.