-1
        my_cur=conn.cursor()
        my_cur.execute("update customer set 'name=%s','address=%s','id proof type=%s','id no=%s','gender=%s','state=%s','pincode=%s','mobile=%s','email=%s','nationality=%s' where 'ref=%s'",( 
                                                                                                                        self.var_name.get(),
                                                                                                                        self.var_addr.get(),
                                                                                                                        self.var_id_proof.get(),
                                                                                                                        self.var_id_no.get(),
                                                                                                                        self.var_gender.get(),
                                                                                                                        self.var_state.get(),
                                                                                                                        self.var_pin.get(),
                                                                                                                        self.var_mob.get(),
                                                                                                                        self.var_email.get(),
                                                                                                                        self.var_natio.get(),
                                                                                                                        self.var.get()   
                                                                                                                        ))
        
        conn.commit()
        self.fetch_data()
        conn.close()

#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 ''name='Sahil'','address='Panchwad'','id proof type='Adhar Card'','id no='123456'' at line 1

1 Answers1

1

I don't know Python, but for MySQL you should not put each assignment into quotes. So not:

"update customer set 'name=%s'..."

but:

"update customer set name=%s..."

You'll probably do need the double quotes around the full string, but not the single quotes inside of it.

ehusmann
  • 39
  • 7