PHPBuilder - Use ignore_user_abort to simulate 'transactions'

RSS Twitter

Use ignore_user_abort to simulate 'transactions'

by: Christopher
October 12, 2000

If you are stuck using a database, such as MySQL, that does not support transactions, you may find that on a particular script you need to do several insert/update queries that either all, or none, must be run.

One good idea is to put this at the very top of your script:

// Prevent user from aborting script $old_abort = ignore_user_abort(true);

And then this at the bottom:

// Reset abort setting ignore_user_abort($old_abort);

This will stop the user pressing 'Stop' from ruining your script!

Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.