I am trying to increase the counter for user messages. The message in my MySQL table has a field like that shows how much you like this particular post. Now, what happens if multiple users like the same post at the same time? I think this will lead to conflict or will not increase correctly? How can I avoid this, do I need to block the row or what parameters do I have?
my query might look something like this:
UPDATE posts
SET likes = likes + 1,
WHERE id = some_value
also, when the user does not access the message, it should decrease → like -1
Thanks for any help!
source
share