A transaction is an indivisible unit of work. That said, a transaction cannot be divided or separated. In databases, a transaction involves multiple queries that require successful execution. If successfully executed, the transaction is committed. If one of the queries fails to execute, a rollback should be used for the entire transaction or parts of the transaction by using a savepoint.
The properties of database transactions are described by the acronym ACID. ACID stands for:
- Atomic: all chanes to the data must be performed successfully or not at all.
- Consistent: Data must be in a consistent state before and after the transaction.
- Isolated: No other process can change the data while the transaction is running.
- Durable: The changes made by a transaction must persist.
PHP functions related to Transactions