In this recent post to his blog Thilanka Kaushalya shows how to use transactions in MySQL databases (using mysqli

Web applications are more popular today than ever with the increasing number of internet users. Most of the standard alone applications converted as web based applications or at least they try to provide a web interface for users. PHP and Mysql are two leading technologies which allow uses on rapid development of web based systems. "Transaction" is a powerful concept which comes with Mysql 4.0 and above versions. Lets explore that.

He introduces the concept of transactions first, providing an example of a bank transfer between two individuals. He uses this to create a simple code sample that turns off the autocommit for the connection (using mysqli_autocommit set to false) and running the SQL in order before the commit. He also includes an example of using the rollback function to return the data back to its original state if there's an error.

Cal Evans has a reminder to all of the businesses out there that have sites and use web site hosting services - only you can prevent web failures and potentially alienate customers.

Last night I wrote the info@ email address on a website and asked a questions about their product. They politely responded with two links to their website. This morning however, when I went to visit them, I was greeted with the message above. It’s now three hours later and the site is still "experiencing difficulties". [...] This problem can be prevented by business owners insisting on – and paying for – “Best Practices” in their software vendors.

He offers a few suggestions to businesses to help prevent this sort of (catastrophic?) failure for their businesses including having a rollout and rollback plan and having a good set of tests to make doubly sure things work before the code even meets the public.

Continuing on with their "mysqli in PHP5" series, DevShed has posted part two highlighting the commit and rollback functions - their use and functionality.

This is the second part of the series "Using mysqli with PHP 5." Welcome back. In three tutorials, this series shows how to use the most important methods and properties included in the "mysqli" extension that comes with PHP 5, in order to take advantage of the new features bundled with MySQL 4.1 and above.

In part one they introduced the extension, providing the background for those just joining in. In this latest part, they take it to the next level and talk about these new handy functions - one to save the updates/additions you're making to the database and the other to undo those changes quickly and easily. As always, there's plenty of examples, explainations, and code to go around.

Continuing on with their "mysqli in PHP5" series, DevShed has posted part two highlighting the commit and rollback functions - their use and functionality.

This is the second part of the series "Using mysqli with PHP 5." Welcome back. In three tutorials, this series shows how to use the most important methods and properties included in the "mysqli" extension that comes with PHP 5, in order to take advantage of the new features bundled with MySQL 4.1 and above.

In part one they introduced the extension, providing the background for those just joining in. In this latest part, they take it to the next level and talk about these new handy functions - one to save the updates/additions you're making to the database and the other to undo those changes quickly and easily. As always, there's plenty of examples, explainations, and code to go around.