Transactions on multiple connections, data integrity fails while one transaction executes
₹600 INR
Chiuso
Pubblicato più di 5 anni fa
₹600 INR
Pagato al completamento
I am trying to work on a transaction based PHP-MYSqli with OOPS code for a small application in the following scenario:
PHP 5.6.x for server and PHP Desktop version phpdesktop-chrome-57.0-rc-php-7.1.3, thus application will run both on 5.6.x and 7.x versions of PHP.
Multiple people can access the same php application simultaneously. This means that every user will have an independent connection available to access the application because I have included a connection on the top of every page through files inclusion. What I want is that when one user presses the submit button, all the tables inside a particular transaction should get locked in read and write mode and none of them should be accessible by any of the users on the same or any other connection. Thus, I want 100% data integrity.
In the attached codes:
First I start executing [login to view URL] and immediately, I also start clicking the go button of [login to view URL] another other browser tab. Following are the results of [login to view URL] when:
Image: [login to view URL] is still executing
Image: when [login to view URL] has finished executing
It is good to see that at the end, I get the accurate results but it is bad to see that even when one transaction is execute, another user is getting the wrong output. The second user should not be able to see anything when the [login to view URL] is executing.
Note: $mysqli->begin_transaction(MYSQLI_TRANS_START_READ_WRITE); doesnt work in my current version of php