Very true! I could verify that cursor.execute () seems to understand "... %s ...", ..."string"... where print () doesn't.. I didn't know that. I could also verify that gumfish's ineffective insertion command works fine for me. (Python 2.4, mysql-3.23.38). So it looks like the problem is with MySQL (e.g. table name, column names, ...) Frederic
----- Original Message ----- From: "Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: <python-list@python.org> Sent: Monday, March 14, 2005 11:55 PM Subject: Re: Can't seem to insert rows into a MySQL table > In <[EMAIL PROTECTED]>, Anthra Norell > wrote: > > > Try to use % instead of a comma (a Python quirk) and quotes around your > > strings (a MySQL quirk): > > > > cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES ('%s', > > '%s', '%s')" % ("a", "b", "c") ) > > AFAIK grumfish made the Right Thingâ. If you use '%', some interesting > things can happen, e.g. if your values contain "'" characters. The "%s"s > without quotes and the comma let the DB module format and *escape* the > inserted values for you in a safe way. > > Ciao, > Marc 'BlackJack' Rintsch > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list