1
arlindo
Using Rollback
  • 2009/12/7 16:04

  • arlindo

  • Just popping in

  • Posts: 23

  • Since: 2007/10/9


Hi there,

I am trying to use this code:

START TRANSACTION

if QUERY_1==FAIL
{
I WANT ROLLBACK
RETURN
}

if QUERY_2==FAIL
{
I WANT ROLLBACK
RETURN
}

I WANT COMMIT


Does anyone knows how do i use this function

2
ghia
Re: Using Rollback
  • 2009/12/7 16:54

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


First you need InnoDB type tables in MySQL and not the regular ISAM.
You specify in the query START TRANSACTION; to start a transaction.
Then you do other operations with queries as INSERT, UPDATE, DELETE, etc.
If one fails do a query with ROLLBACK; and all operations after the transaction start become undone.
If all went good do a query with COMMIT;

Login

Who's Online

105 user(s) are online (81 user(s) are browsing Support Forums)


Members: 0


Guests: 105


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits