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") ) Frederic ----- Original Message ----- From: "grumfish" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: <python-list@python.org> Sent: Saturday, March 12, 2005 7:24 PM Subject: Can't seem to insert rows into a MySQL table > I'm trying to add a row to a MySQL table using insert. Here is the code: > > connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", > db="japanese") > cursor = connection.cursor() > cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s, > %s)", ("a", "b", "c") ) > connection.close() > > After running, a SELECT * on the table shows no new rows added. Adding > rows using the MySQL client works fine. With the Python script, nothing. > There are no exceptions raised or any output at all. The rowcount of the > cursor is 1 after the execute is 1 and the table's auto_increment value > is increased for each insert done. Can anybody help? I'm fairly new to > MySQL so I'm afraid its going to be a stupid oversight on my part. Thank > you. > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list