title: MySQL statement in Python: Variables don't work
body: <p>I have a problem with MySQL and Python's MySQLdb when I try to INSERT more than one variable.</p>
  
  <p>I have a table wordurl with three fields. The first one is an auto_increment ID, second and third should hold the values. Second and third fields are named word_id and url_id. </p>
  
  <p>This is the code.</p>
  
  <pre><code>cursor.execute("INSERT INTO wordurl (word_id, url_id) VALUES (%s, %s)", (word_temp_id, url_temp_id))
  </code></pre>
  
  <p>When I try to INSERT only one value the code works, two not. </p>
  
  <p>Error message:</p>
  
  <pre><code>(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '),), (('2',),))' at line 1")
  </code></pre>
  
  <p>I also tried it with tripple ticks around the statement, the variables with and without bracket, without the field names and with the first id field included. I also tried with C-style-printf-stuff % (which isn't clever!). Nothing worked. </p>
  
  <p>And you, glorious people on stackoverflow, you are my last hope :)</p>
  
  <p>MySQL-Server is 5.5.9 on FreeBSD 8.2. Python version is 2.7:82508 on OSX Lion</p>
  
  <p>Thanks in advance!</p>
  
  <p>Steffen</p>
  
  <p>UPDATE: I use cursor.fetchall() and cursor.fetchone() to get the IDs. Maybe this information is important.</p>