Ben şu sorunla karşı karşıya
function book($memberid, $classid){
if (!book){
// update the db and change the book variable to true
}
}
My problem is 2 requests submitted at the same time. The first request passes the line if (!book){ but not yet update the db. And at the same time, the second request runs the same function and also passes the line if (!book){. Therefore, the result is wrong.
I want to know how to solve this concurrency problem. Lock the db? But I am afraid that it will affect the performance.