#native_company# #native_desc#
#native_cta#

Use ignore_user_abort to simulate ‘transactions’

By Christopher
on 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!