For fun I am replacing the mysqli extension in my app with PDO.
Once in awhile I need to use transactions + table locking.
In these situations, according to
When you call PDO::beginTransaction(), it turns off auto commit.
So you can do:
$db->beginTransaction(); $db->exec('LOCK TABLES t1, t2, ...'); # do something with tables $db->commit(); $db->exec('UNLOCK TABLES');
After a commit() or rollBack(), the database will be back in auto commit mode.