Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Both PDO and MySQLi have support for transactions. A transaction, is a set of SQL queries that's executed as a single unit. Changes are committed to the database, only if each part of the transaction is successful. If an error occurs at any stage during the transaction, you can roll back each record, to its original value. This is particularly useful for operations such as financial transfers, where it's vital that all parts of the transaction succeed.
Another advantage, is that all parts of a transaction are grouped into a single execution unit that locks records to prevent them from being modified by another connection. If you're using MySQL or MariaDB as your database, data must be stored using the InnoDB engine on MySQL or XtraDB on MariaDB. Some commands can't be rolled back. This mainly affects SQL statements such as drop, alter and create.
That define the structure of tables and databases. You can't use transactions with MyISAM tables. Neither PDO nor MySQLi ,issue a warning if you try to do so. They simply ignore rollback commands. MyISAM, was the default storage engine, prior to MySQL 5.5. So you might need to convert your tables, if you want to use transactions. If you're not sure how to convert a table from MyISAM to NODB, check out chapter five of my course, Up and Running with phpMyAdmin here on lynda.com
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101819 Viewers
61 Video lessons · 88574 Viewers
71 Video lessons · 72391 Viewers
56 Video lessons · 104093 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.