If a lot of users calling same PHP scripts at same time. What is the order of executions?
Will it be queued? After finished executed for 1 session, it will execute another?
I am very new to server side programming. The PHP I am writing will access database, and query database with transactions(meaning there is commit and rollback if any query in the transaction is failed). If the PHP are executed without order, it apperantly will mess up the thing.
[Add] Thanks for the replys, I will be more specific about the problem:
Its a online game communicating with server via PHP. Transaction is needed to make sure everything is consistent. Like registering a new player, we don’t want the talbe “PlayerData” is inserted and “PlayerInventory” failed because of some error. They supposed to success or fail as whole.
So if the PHPs execute at same time, then “Rollback” Or “Commit” will possibly to rollback or commit the trasaction running by other PHP at same time.
So, what is the solution for this?
Thanks in advance
regarding your update…
Each php request will have its own db connection, so if you rollback on one connection it wont affect other php requests. its that easy :), as long as you are using transactions, database should free you from fears of inconsistency.
Usually php requests use short living process, so if you got 10 concurrent users every one will have his own process, the moment the request is fulfilled the process is killed