At 7:19 AM +0100 5/24/06, Stut wrote:
PHP is not 'sequential' and I have no idea where you got that
impression. If the browser puts in a request to the server, the
server will execute that request as soon as sufficient resources are
free to do so. PHP does not 'lock' the session between requests.
This is a problem being found by people trying AJAX with a session.
Consider this sequence...
1) User hits your button (ooh-err)
2) PHP starts processing the script and runs session_start() which
loads the session data
3) User hits your button again
4) PHP starts processing the script a second time before the first
run has finished, and loads the session data again for this new
request
5) The execution started in 2) ends and commits the session data
back to the session store
6) The execution started in 4) ends and commits the session data
back to the session store
Nice explanation.
Ajax people are finding this happening w/o sessions.
Back to the posters problem, which is duplicate dB entries caused by
double clicking.
Apparently the problem isn't solvable by using tokens, sessions,
locking, and such. So why not just check the dB to see if the current
record has already been entered? If so, don't do it again.
Isn't this a solution? Or is there something here that I'm not understanding?
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php