我正在使用 Python MySQL 連接器通過更新行將數(shù)據(jù)添加到表中。用戶輸入序列號,然后添加序列號所在的行。我不斷收到 SQL 語法錯誤,但我不知道它是什么。 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()錯誤: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”是用戶輸入的序列號,表中已經(jīng)存在。
添加回答
舉報
0/150
提交
取消