I know there is a few posts on this already just wondering how secure it is to use
UPDATE table SET field = field + 1 WHERE [...]
What if the server lag out for a sec? Say 2 users click the page at the same time, will that cause them to both read the field as the same number and both increment that same field by 1? I’m guessing since it’s mysql it has some sort of query system by doing one at a time but not sure if that is true, only assuming that’s true.
In this example the read and update are occurring in the same statement. Statements are atomic (i.e. you can consider them to behave in a transactional way), so all’s good.