title: Python/MySQL query error: `Unknown column`
body: <p>This script is meant to act as a command-line front-end to add records to a locally hosted MySQL database.</p>
  
  <p>I am getting this error:</p>
  
  <p><code>mysql.connector.errors.ProgrammingError: 1054 (42S22): Unknown column 'watermelon' in 'field list'</code></p>
  
  <p>But <strong>watermelon is the value I am trying to enter, not the column name!</strong></p>
  
  <p>Here is the script:</p>
  
  <pre><code>#! /usr/bin/python
  
  #use command line as front end to enter new rows into locally hosted mysql database
  
  import mysql.connector
  
  #create inputs
  new_fruit = raw_input('What fruit do you want to add? ')
  new_fruit_type = raw_input('Which type of ' + new_fruit + '? ')
  
  #connect to dbase
  conn = mysql.connector.connect(user='root', password='xxxx', database='play')
  
  #instansiate cursor
  cursor = conn.cursor()
  
  #define sql statement
  add_record = "INSERT INTO fruit (name, variety) VALUES (%s, %s)" % (new_fruit, new_fruit_type)
  
  #execute sql
  cursor.execute(add_record)
  
  #close out
  conn.commit()
  cursor.close()
  conn.close()
  </code></pre>
  
  <p>And the table schema: </p>
  
  <pre><code>mysql&gt; describe fruit;
  +---------+----------+------+-----+---------+----------------+
  | Field   | Type     | Null | Key | Default | Extra          |
  +---------+----------+------+-----+---------+----------------+
  | id      | int(11)  | NO   | PRI | NULL    | auto_increment |
  | name    | char(30) | YES  |     | NULL    |                |
  | variety | char(30) | YES  |     | NULL    |                |
  +---------+----------+------+-----+---------+----------------+
  3 rows in set (0.00 sec)
  </code></pre>