I am new to using transactions.
Basically, I am able to successfully lock a single row in the MySQL console using START TRANSACTION
followed by a SELECT ... FOR UPDATE
statement. The row remains locked until I run the COMMIT
command in the console
However, when I do the same in a PHP script using $db->beginTransaction()
followed by $db->execute("SELECT ... FOR UPDATE")
, the row does not get locked before I run a $db->commit()
script.
What I mean is I can still successfully do a SELECT ... FOR UPDATE
statement in the console even before I run a commit script in PHP to end the transaction. Does this mean my PHP script is not successfully locking the row during the transaction? How am I able to check?