How do I set the isolation level of a transaction to 'SERIALIZABLE' in PHP using mysqli? I have looked everywhere and I can't find any information on it.
Here is an explanation of the isolation levels.
You can just set the isolation level in a query before you run your statements. This assume that you do everything using the same session:
$mysqli = new mysqli('localhost', 'user', 'pass', 'db');
$mysqli->query("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE");
...
You may also want to turn off autocommit before hand since it changes the way serializable isolation works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With