| Post ID |
Timestamp |
Content |
User |
| 792192 |
2009-07-16 05:24:00 |
if i have a website using php and mysql where the first person to click on a particular button wins a prize, what happens if 10 people click on the button at the exact same time including milliseconds? how does php/mysql pick who clicked the button first? |
lance4k (4644) |
| 792193 |
2009-07-16 06:08:00 |
That depends entirely on how you wrote your script. If you did a good job, then whichever one hits the database first will be the winner. If you did a bad job, then it could be any of them, as you'll run into race conditions. If you did a really bad job you may even get some nice error messages out of it :p.
Edit: To be slightly more specific, it depends on how you implemented your locking / semaphore system. |
Erayd (23) |
| 792194 |
2009-07-16 06:35:00 |
Unless you have a huge amount of people viewing the site or whatever i wouldnt worry about milliseconds, but as Erayd said if the script was well written then it would be first in first served |
hueybot3000 (3646) |
| 1 |
|