b0r Posted July 2, 2008 Share Posted July 2, 2008 Hello, I am new to php/ajax and I am currently building a web site. I am wondering how periodic update requests from users are handled by the server. If the database and website needs to be updated reguarly (every 30 sec or so) how would I do this? I read about cron jobs which would allow the database to be updated without user interaction but currently I am not in any position to use that. I did think about just letting the requests from the users actually update the database but then i got worried about how to handle possible race conditions. If the script requested by the user contains logic between calls to the database then I assume it is possible for other requests to pre-empt the first request and all various problems might arise because of this. My question is basically how I should go about to solve this. What I want is for the database to be updated correctly, data needs to be updated according to the time and value of other stored values in the database. If this update is separate from user interaction or not does not matter as long as no data is corrupted. I guess it would be possible to solve this using transactions and smart queries but it doesn't sound like that is how it should be solved. Perhaps some sort of event scheduling in the database just using stored routines is a better choice. I am ranting now Regards b0r. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.