Ask a question about mysql data burst
A zy
A zy 2020-10-18 14:29:45
0
1
1001

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

A zy
A zy

reply all(1)
火离

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;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!