title: Python 3 Update MySQL database table
body: <p>I have just found the pymysql module for connecting Python to a MySQL database.  I have a database set up with a table named 'loot', loot contains a column called 'wins'.  My code contains a variable named 'won' that is given a value right before the SQL line.  I want the variable 'won' to be entered into the 'wins' column where id=1.  The id=1 row already exists in the database.</p>
  
  <p>The code below throws an error <code>pymysql.err.InternalError: (1054, "Unknown column 'won' in 'field list'")</code></p>
  
  <p><strong>My Question:</strong> Why am I getting this error and what am I doing incorrectly?</p>
  
  <p><strong>The Code:</strong> </p>
  
  <pre><code>import pymysql
  
  # Open database connection
  db = pymysql.connect(host='*******',user='******',password='*****',db='******')
  
  # prepare a cursor object using cursor() method
  cursor = db.cursor()
  
  won=1
  
  # Prepare SQL query to UPDATE required records
  sql = "UPDATE loot SET wins = won WHERE id = 1"
  
  # Execute the SQL command
  cursor.execute(sql)
  
  # Commit your changes in the database
  db.commit()
  
  # disconnect from server
  db.close()
  </code></pre>