9.17 TransactionsThis is NOT the latest copy of this book; click here for the latest version.
The ability to group SQL statements into groups that can be committed or rolled back en masse is only available in the InnoDB table handler in MySQL - MyISAM does not support transactions, and will silently ignore any transaction-control statements. To get started with a transaction, send the "BEGIN" SQL statement through mysql_query(), followed by as many statements as you want, then either "COMMIT" or "ROLLBACK" to save or abort your changes.
Changed made inside transactions are, by default, visible only to yourself - once you use COMMIT, the changes are made permanent, and everyone can see them. Once you use COMMIT or ROLLBACK, you need to use another BEGIN to start a new transaction.
|
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.
My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!
|