Basically how it happens is there is a prize database table. let's say it looks like this:
There's another table called prize_user_claimed
prize_id | prize_amt
DsdjD | 10
osdjk | 12
When a user clicks the claim link for the first one, it looks like: claim.php?id=DsdjD
When that happens I query the first table for a row with prize_id matching the ID in the url if mysqli_num_rows < 1 (since I delete prizes from the first table when they are claimed) then that means it has already been taken. So I print out the message
"This prize has already been claimed!"
If it hasn't been claimed, I add a record to the second table with the prize hash (DsdjD in this case) and delete the record in the first table.
This works perfectly, but in times of high user traffic if two users click the link very closely to each other, they both get it. This wouldn't be much of a problem if I was using a number ID with AI, but the site really needs to use the unique hashes.
What would be ideal is if there could be a way to see all the users trying to access the page and then sort it in the order they clicked the link. And then to be able to interact with that info in PHP.
Any ideas on how this could work? I can't really lock the table because I still want the other links to be active... and I reaaaaally don't want to get rid of the hashes.