I made a like-unlike feature in my iOS-PHP Application.
(Of course userId and session is in the get parameter also)
Calling like.php?id=10 does two things
- checks if the content 10 is liked already,
- if not then adds a row to the database’s table
Calling unlike.php?id=10 removes the like the user has made.
—————
The problem is, that sometimes if the user likes-unlikes the given content too fast, my table will receive 2 rows of the given like.
————
I assume it is because two requests to the like.php file happens exactly at the same moment..
What could I do to prevent multiple rows from same user?