unistake Posted December 3, 2010 Share Posted December 3, 2010 Hi all, I have a list of information that needs to be individually deleted from mysql after 3 months of being on the website. How would I go about this - can one make a php script run 24 hours a day or maybe just refresh at a certain time everyday to check each row (about 300 rows total) in a mysql db and delete as appropriate? Many thanks Link to comment https://forums.phpfreaks.com/topic/220603-is-a-247-refreshing-script-possible/ Share on other sites More sharing options...
requinix Posted December 3, 2010 Share Posted December 3, 2010 You can schedule a script to run whenever you want (like once a day). Exactly how depends on the operating system. Google keywords include "cron" (for Linux) and "task scheduler" (for Windows). Don't forget to add "php" to your query. With PHP, it's generally a bad idea to make something that runs continuously. It's not meant for that. If you're thinking in terms of "garbage collection" (ie, you want to delete old data because it's old and taking up space) then you can just insert some code into your website that randomly (like 1% chance each time it's run) scans for old information and deletes it. No need for a scheduler then. Link to comment https://forums.phpfreaks.com/topic/220603-is-a-247-refreshing-script-possible/#findComment-1142715 Share on other sites More sharing options...
unistake Posted December 3, 2010 Author Share Posted December 3, 2010 ok thanks I'll take a look. In the last example - you mean just add the script in to a php page that is used about once a day by a website user? Link to comment https://forums.phpfreaks.com/topic/220603-is-a-247-refreshing-script-possible/#findComment-1142717 Share on other sites More sharing options...
sweeb Posted December 3, 2010 Share Posted December 3, 2010 Yeah, you can put it in a script that's used once a day-- or if a page gets used 100 times a day have a function that does it 1% of the time Link to comment https://forums.phpfreaks.com/topic/220603-is-a-247-refreshing-script-possible/#findComment-1142738 Share on other sites More sharing options...
unistake Posted December 3, 2010 Author Share Posted December 3, 2010 ok good idea, I will do that - like a login script Link to comment https://forums.phpfreaks.com/topic/220603-is-a-247-refreshing-script-possible/#findComment-1142752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.