The problem is that the SQL syntax is incorrect. The request should be:
UPDATE g_ent SET total_points = total_points + %s WHERE e_id = %s AND user = %s;
So a complete example:
cursor = database.cursor() cursor.execute("""UPDATE g_ent SET total_points = total_points + %s WHERE e_id = %s AND user = %s;""", (new_points, e_id, user_name)) # order of params revised database.commit()
Please note that the order of the request parameters has been changed.
source share