svgmx5 Posted September 29, 2010 Share Posted September 29, 2010 I have a counter that updates the database automatically with out refreshing the page. However i was wondering if someone can give me some pointers on how i can keep it updating the database even after someone exits the page. Currently it updates the database every 2 seconds by increasing the number by 1..however i want to be able to do this even if the page i not loaded is there any way i can do this? Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/ Share on other sites More sharing options...
yaMz Posted September 29, 2010 Share Posted September 29, 2010 Cron jobs. Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/#findComment-1117037 Share on other sites More sharing options...
svgmx5 Posted September 29, 2010 Author Share Posted September 29, 2010 is this the only thing that can do this? Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/#findComment-1117044 Share on other sites More sharing options...
yaMz Posted September 29, 2010 Share Posted September 29, 2010 I'm confused as to what you are updating, however AJAX is the solution for you. Google: HttpXmlRequest Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/#findComment-1117046 Share on other sites More sharing options...
svgmx5 Posted September 29, 2010 Author Share Posted September 29, 2010 sorry for not being more clear... Here's what i got... I currently have a page with a counter that uses ajax and php to update a database every 2 seconds...it like a click counter expect it does not require anything to be clicked to update. What i've been trying to figure out is how i keep updating the database even after the user has left the page...so if nobody is looking at the site then i still want the database to keep updating. right now it just updates when the webpage is open, as soon as i close it it stops updating does anyone know if this is possible? Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/#findComment-1117047 Share on other sites More sharing options...
yaMz Posted September 29, 2010 Share Posted September 29, 2010 Hmm, well if your host allows it you could always run a background daemon. I don't have any experience in this sort of programming, so I can't really help you. Maybe someone else can, if not: [google] http://bipinb.com/making-php-program-as-daemon.htm Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/#findComment-1117053 Share on other sites More sharing options...
svgmx5 Posted September 29, 2010 Author Share Posted September 29, 2010 thanks, Do you know if this might work with windows server? and would there be any security issues by maybe doing something like this? Quote Link to comment https://forums.phpfreaks.com/topic/214692-help-with-this-counter/#findComment-1117054 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.