View Single Post
Old 08-06-2009, 10:21 PM   #10 (permalink)
devnull
The Wanderer
 
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
devnull is on a distinguished road
Default

Transactions are pretty easy to implement just execute the following in this order;

Code:
# Start the SQL Transaction
mysql_query("begin transaction");
Then execute any update/delete/insert queries

Code:
mysql_query("insert into......");
mysql_query("insert into......");
mysql_query("insert into......");
and finish off with

Code:
# Commit the changes
mysql_query("commit");
If any of the queries fail or a commit is not received(in the case of doing a die), the transaction(any queries executed) won't be committed to the database. Its as easy as that.
Send a message via Skype™ to devnull
devnull is offline  
Reply With Quote