I'm currently getting an error when attempting to update two columns of my MySQL database using mysql.connector and python 3.6. When I execute the command below I get:
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 'order='1' WHERE (match_id='2051673' AND gametime=80 AND event_name='Pass')' at line 1
But, as far as I can tell, my command is perfectly legit. What am I doing incorrectly? Thanks!
for item in pass_list:
query = """UPDATE events SET event_key=%s AND order=%s
WHERE (match_id=%s AND gametime=%s AND event_name=%s)"""
values = (item[0],item[7],item[1],item[2],item[3])
cur.execute(query, values)
conn.commit()
conn.close()
orderis a SQL keyword. You can put backticks around it:`order`.