A table user data is as follows
id----user----num
1----aaaa----0
2- ---bbbb----2
There is a php file. When executed, the num of ID 1 will be incremented by 1. Now many people are accessing this php file at the same time. Will this cause any problems? The value recorded by num is incorrect or wrong
When there are few people, the overview will not be encountered; when a certain amount of time, num 1 logic is completed, and the data is not saved, other visitors num 1 has been executed multiple times; the values of other ids here will be the same. Repeat; if you set a unique primary key for id, the save will fail;
It is recommended to use mysql pessimistic lock;