Can't seem to insert rows into a MySQL table
Stephen Prinster
prinster at mail.com
Sat Mar 12 14:05:43 EST 2005
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, but it seems like the first time I used MySQLdb, I was
confused by the need to do a "fetchall()" (or "fetchone()" or
"fetchmany()") after executing the SELECT.
Something like this (not tested):
result = cursor.execute(SELECT * FROM edict WHERE kanji = 'a')
print result.fetchall()
HTH,
Steve P.
More information about the Python-list
mailing list