ajjohnson190
ajjohnson190

Reputation: 513

mysql.connector.errors.ProgrammingError: Error in SQL Syntax

I'm using the Python MySQL connector to add data to a table by updating the row. A user enters a serial number, and then the row with the serial number is added. I keep getting a SQL syntax error and I can't figure out what it is.

  query = ("UPDATE `items` SET salesInfo = %s, shippingDate = %s, warrantyExpiration = %s, item = %s, WHERE serialNum = %s")
        cursor.execute(query, (info, shipDate, warranty, name, sn, ))
        conn.commit()

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 'WHERE serialNum = '1B0000021A974726'' at line 1

"1B0000021A974726" is a serial number inputted by the user and it is already present in the table.

Upvotes: 0

Views: 218

Answers (1)

danblack
danblack

Reputation: 14666

No , before the WHERE statement

Upvotes: 1

Related Questions