MySQL Forums
Forum List  »  Connector/Python

Re: Problem inserting data from form
Posted by: andreas gjersøe
Date: January 24, 2007 03:32PM

I had problems inserting data to my tables. As you mensioned, everything is running fine without any error messages. I solved my problem by adding commit .
This worked for me:

import MySQLdb

conn= MySQLdb.connect (host = "localhost",
user = "********",
passwd = "********",
db = "*****")

cursor= conn.cursor ()
cursor.execute ("INSERT INTO table1(col1, col2) VALUES('val1', 'val2')")

#Do your things here

cursor.execute ("COMMIT")
cursor.close ()
conn.close ()

Jan Paricka Wrote:
> Hi Dougles,
> Did you manage to work out this problem?
> What was it?
> I'm asking as I do have a similar problem as you
> did.
> Instert into database seems to be runing fine ,
> even an id which is unique auto-incremental field
> is updated but no record is entered.
> I've checked all my SQL statements and they seems
> to be fine when running them manually.
> Thanks for letting me know.
> Cheers,
> Jan

Options: ReplyQuote

Written By
November 01, 2006 08:54PM
Re: Problem inserting data from form
January 24, 2007 03:32PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.