Re: Can't seem to insert rows into a MySQL table

2005-03-15 Thread Andy Dustman
Anthra Norell wrote: > 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

Re: Can't seem to insert rows into a MySQL table

2005-03-15 Thread Anthra Norell
o 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: Sent: Monday, March 14, 2005 11:55 PM Subject: Re: Can't seem to

Re: Can't seem to insert rows into a MySQL table

2005-03-14 Thread Marc 'BlackJack' Rintsch
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â.

Re: Can't seem to insert rows into a MySQL table

2005-03-14 Thread Anthra Norell
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

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread deelan
deelan wrote: which version of MySQLdb are you running? versions 1.1.6 and below gained a connection.autocommit) method set by default ehm, 1.1.6 and *above*, of course. :) -- "Però è bello sapere che, di questi tempi spietati, almeno un mistero sopravvive: l'età di Afef Jnifen." -- dagospia.com -

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread deelan
grumfish wrote: 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", "

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Stephen Prinster
grumfish wrote: 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. If the auto_increment is increased, then it seems like the row was inserted. Are you sure the problem is not with your SELECT attempt? Just a guess, b

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Patrick Useldinger
grumfish wrote: 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() Just a guess "in the dark" (I don't use MySQL):