SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: rollback

  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    rollback

    HI everyone

    suppose I have a situation like this

    In an if or else clause I run multiple sql queries, lets say I update two
    different tables,but something happened, and only one query was
    executed, is there a way of finding out if both the queries were not executed and then rollback the one that was done ..

    Sorry if this is vague,I have no code as yet, but basically I am looking at
    inserting into one table and then updating another but if both does not happen then the one that happened must be rolled back.

    I am using mysql and PHP

    Thanks
    Niva

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    if you are using innodb tables, you can use transactions. see http://dev.mysql.com/doc/mysql/en/commit.html

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI

    I am using default MYSQL type MYISAM

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    you will either have to switch to innodb tables, or you will have to do this in PHP.

  5. #5
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks

    Can I use rollback with myisam

  6. #6
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    um, no! that's why i said you have to use innodb tables, and so does the page i referenced in my first post.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •