D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] OT - Inserting into MySQL Database table using Python...

 

Hi all,

I'm trying to add some data into a MySQL database using Python 2.6.5.
I'm using the following:
  cursor.execute( 'INSERT INTO table (fielda, fieldb) VALUES ("%s","%s")' ) % 
(variable_a, variable_b)
but, alas, what ends up in the table is "%s" and not the contents of the variables. 
:(

Any suggestions on what's the problem?

Cheers.
Grant.


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html