Recall & Review
beginner
What is a transaction in database management?
A transaction is a group of one or more operations performed as a single unit. It ensures that either all operations succeed together or none do, keeping data safe and consistent.
Click to reveal answer
intermediate
What are the four key properties of a transaction (ACID)?
ACID stands for:<br>1. Atomicity - all or nothing<br>2. Consistency - data stays correct<br>3. Isolation - transactions don’t interfere<br>4. Durability - changes are saved permanently
Click to reveal answer
beginner
How do you start a transaction in PHP using PDO?
Use the method
beginTransaction() on your PDO object to start a transaction.<br>Example:<br>$pdo->beginTransaction();Click to reveal answer
beginner
What PHP PDO methods are used to save or cancel a transaction?
To save changes, use
commit().<br>To cancel changes, use rollBack().<br>Example:<br>$pdo->commit(); or $pdo->rollBack();Click to reveal answer
beginner
Why is transaction management important in web applications?
It keeps data safe when multiple users or processes work at the same time. It prevents errors like partial updates or lost data, making apps reliable and trustworthy.
Click to reveal answer
Which method starts a transaction in PHP PDO?
✗ Incorrect
The correct method to start a transaction in PHP PDO is
beginTransaction().What does the commit() method do in transaction management?
✗ Incorrect
commit() saves all changes made during the transaction permanently.Which ACID property ensures that transactions do not affect each other?
✗ Incorrect
Isolation ensures that transactions run independently without interfering with each other.
If an error occurs during a transaction, which method should be called to undo changes?
✗ Incorrect
The
rollBack() method undoes all changes made during the transaction.Why is transaction management important in multi-user applications?
✗ Incorrect
Transaction management prevents conflicts and keeps data consistent when many users access the system.
Explain the ACID properties of a transaction and why each is important.
Think about how each property helps keep data safe and reliable.
You got /5 concepts.
Describe how to use PHP PDO to manage a transaction including starting, committing, and rolling back.
Imagine you are making changes to a database and want to control when they are saved or undone.
You got /4 concepts.