title: Python: Error in MySQL
body: <pre><code>import MySQLdb    
  import random
  
  db = MySQLdb.connect (host = "localhost", user = "python-test", passwd = "python", db = "python-test")
  
  cursor = db.cursor()
  
  var = .3
  
  sql = "INSERT INTO RandomInt 
           (RAND) 
         VALUES 
           (var)" # RandomInt is the name of the table and Rand is the Column Name
  
  cursor.execute(sql)
  
  db.commit()
  db.close()
  </code></pre>
  
  <p>I get an error saying <code>Operational Error: (1054, "Unknown column 'var' in 'field list'")</code> Why do I get this error and how do I fix this although I have already defined var?</p>