Menu

INSERT won't save in table

Help
Keilin
2005-07-12
2012-09-19
  • Keilin

    Keilin - 2005-07-12

    I have a very simple python script that I'm using. It can read items from a table, and I've tried the user seperately from the command line and it can read/write everything fine.

    When I try to INSERT something into the table, the values don't stay, the cursor can read them until the connection is closed, but nothing else can and they just seem to go away. Is there something I'm misisng with al this?

     
    • Andy Dustman

      Andy Dustman - 2005-07-13

      Try calling db.commit() where db is your database connection object.

       
      • Keilin

        Keilin - 2005-07-13

        Hey

        Nope that didn't have any affect on the database :(

         
        • Keilin

          Keilin - 2005-07-13

          I should add:
          I'm running it on windows XP pro
          mySQL 4.1
          Python 2.4

           
        • Andy Dustman

          Andy Dustman - 2005-07-13

          You realize that you should call it after your INSERT statement is invoked (with cursor.execute()) but before you close the database (db.close()), right? I code example is always helpful for diagnosing these problems.

           
          • Keilin

            Keilin - 2005-07-13

            No I didn't actually, that did it!

            Thank you so much.

             

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.