avillanu Posted August 24, 2007 Share Posted August 24, 2007 I'd like to have a "daily views" for my CMS. Of course, this number would reset every 24 hours. Would this be possible without a crontab? Link to comment https://forums.phpfreaks.com/topic/66551-not-using-crontabs-possible/ Share on other sites More sharing options...
tarun Posted August 24, 2007 Share Posted August 24, 2007 I Found This Code Which Simluates A Crontab Description: If you want to simulate a crontask you must call this script once and it will keep running forever (during server uptime) in the background while "doing something" every specified seconds (= $interval): <?php ignore_user_abort(); // run script in background set_time_limit(0); // run script forever $interval=60*15; // do every 15 minutes... do{ // add the script that has to be ran every 15 minutes here // ... sleep($interval); // wait 15 minutes }while(true); ?> Link to comment https://forums.phpfreaks.com/topic/66551-not-using-crontabs-possible/#findComment-333348 Share on other sites More sharing options...
micmania1 Posted August 24, 2007 Share Posted August 24, 2007 $date = date("d-m-Y").' 00:00:00; // show views from only today($date) onwards I don't know how your accessing this data (MySQL, arrays etc...) so I can't really assist you any more than I have. This will take place everytime the page loads but that's all you need. Hope it helps. Link to comment https://forums.phpfreaks.com/topic/66551-not-using-crontabs-possible/#findComment-333495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.