title: Insert dictionary keys values into a MySQL database
body: <p>I have executed this code to insert a dictionary into my table in database, </p>
  
  <pre><code>d = {'err': '0', 'tst': '0', 'Type o': 'FTP', 'recip': 'ADMIN', 'id': '101', 'origin': 'REPORT', 'Type recip': 'SMTP', 'date': '2010-01-10 18:47:52'}
  
  db = MySQLdb.connect("localhost","admin","password","database")
  cursor = db.cursor()
  cursor.execute("""INSERT INTO mytable(ID, ERR, TST, DATE, ORIGIN, TYPE_O, RECIP, TYPE_RECIP) VALUES (%(id)s, %(err)s, %(tst)s, %(date)s, %(origin)s, %(Type o)s, %(recip)s, %(Type recip)s)""", d)
  
  db.commit()
  db.close()
  </code></pre>
  
  <hr>
  
  <p>Create statement of my table: </p>
  
  <pre><code>CREATE TABLE mytable (
        `ID` tinyint unsigned NOT NULL,
        `ERR` tinyint NOT NULL,
        `TST` tinyint unsigned  NOT NULL,
        `DATE` datetime NOT NULL,
       `ORIGIN` varchar(30) NOT NULL,
       `TYPE_O` varchar(10) NOT NULL,
       `RECIP` varchar(30) NOT NULL,
       `TYPE_RECIP` varchar(10) NOT NULL,
       PRIMARY KEY (`ID`,`DATE`)
  ) ENGINE = InnoDB; 
  </code></pre>
  
  <hr>
  
  <p>But i have an error, it says:</p>
  
  <blockquote>
    <p>1064, "you have an error in your SQL syntax; check the manual that
    corresponds to you MySQL server version... )</p>
  </blockquote>