I was wondering how the PHP and MySQL scripts work? A script is basically two SQL queries.
The first is SELECT and gets the number from the column of a specific row defined by some id.
Then, if the number is positive, the second UPDATES column subtracts a certain amount.
Obviously, this is a classic case when I will use transactions or locks or mutexes or what next.
My questions are:
On a website, it is entirely possible that two or more users can invoke a script on the same line at the same time. If you are not using transactions or locking tables, how will PHP handle this? These are two requests / functions, but they are in the same script. Wait until the entire script returns the corresponding user to him, to run it again for another user or because they are different requests due to pseudo-parallelism, he can run the first request for several users calling the same script, and then the second for another set.
Basically I ask because I do that I do not have enough rights to use transactions or locks, and I want to know if I can avoid the mutex (I'm not sure about this word, basically a new table for callers, before calling the script above, I will send a new script before that, where I will return the boolean column of the table true for writing so that other people cannot until the original script ends, and then bacl to false, so the next one on the line can and so on)
Edit:
I am not sure about the choice for updating whether permissions for this will be included in the above. The guy in charge of answering my questions is hard to find, and I had it with me, looking for him ...
source
share