79257210

Date: 2024-12-06 07:52:06
Score: 1.5
Natty:
Report link

The error is due to the UPDATE statement. When updating values in MySQL, you cannot use the VALUES keyword like you would in an INSERT statement. Instead, you need to assign new values directly to the columns.

Use this:
import mysql.connector

item_id = 123 query = ( "UPDATE MyTable " "SET col1 = %s, col2 = %s, col3 = %s, col4 = %s " "WHERE item_id = %s" ) items = (val1, val2, val3, val4, item_id)

cursor.execute(query, items)

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Ogo Ndugba