Answer the question
In order to leave comments, you need to log in
How to set exclusive transaction in mysql?
A small example, not a real situation, but just to understand the task:
File test1.php
mysqli_query($connect, 'START TRANSACTION');
mysqli_query($connect, 'SELECT @var:=value FROM userinfo WHERE id=1');
sleep(10);
mysqli_query($connect, 'UPDATE userinfo SET [email protected] + 1 WHERE id=1');
mysqli_query($connect, 'COMMIT');
mysqli_query($connect, 'START TRANSACTION');
mysqli_query($connect, 'SELECT @var:=value FROM userinfo WHERE id=1');
mysqli_query($connect, 'UPDATE userinfo SET [email protected] + 1 WHERE id=1');
mysqli_query($connect, 'COMMIT');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question