Lukela Posted November 30, 2007 Share Posted November 30, 2007 I need help, this is my problem...I have this information being inputted into the database, than from the time it is inserted into the database, in 45 days exactly... I want it deleted. Anyone know how I can do this? Quote Link to comment Share on other sites More sharing options...
marcus Posted November 30, 2007 Share Posted November 30, 2007 Do a cron for every 45 days, lol. Quote Link to comment Share on other sites More sharing options...
btherl Posted November 30, 2007 Share Posted November 30, 2007 It depends on how accurate the 45 days has to be. There's a number of approaches. 1. Have a cron job run every minute (or 5 minutes, 10 minutes, 1 hour, depending on your accuracy requirement) that deletes old entries 2. Have your scripts simply ignore any entry older than 45 days. 3. Have your scripts check each time they run and clear any old entries. Quote Link to comment Share on other sites More sharing options...
Lukela Posted November 30, 2007 Author Share Posted November 30, 2007 ohhh yeahhhhh....... I sooooo totally forgot about Crons.. Haha Thanks! Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 30, 2007 Share Posted November 30, 2007 well php can't be a continuous function, we can only activate it from time to time, the trick to avert this problem is to run your query for results that are only greater than 45 days old. Then above this use cron to run a script everyday to delete all invalid records (older than 45 days) Don't over abuse cron make it 1 time a day at most Quote Link to comment Share on other sites More sharing options...
Aureole Posted November 30, 2007 Share Posted November 30, 2007 Don't over abuse cron make it 1 time a day at most I have a CRON run every 20 minutes, is this a bad thing? Quote Link to comment Share on other sites More sharing options...
btherl Posted November 30, 2007 Share Posted November 30, 2007 20 minutes is fine. The frequency with which a cron job runs should be inversely proportional to the work it does. For example, a cron job that does 1 hour of heavy processing should usually be run no more than once per day. But a job that does 1 second of processing can be run every 5 minutes without any adverse effects. Quote Link to comment Share on other sites More sharing options...
Aureole Posted November 30, 2007 Share Posted November 30, 2007 Oh ok, well it just queries the database and for each member who has been inactive for more than x seconds updates the database to show that they are offline... not really intensive. I shouldn't have hijacked this thread but since cooldude832 brought that up... 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.