boionfire81 Posted July 5, 2016 Share Posted July 5, 2016 Using mysqli timestamp, and mccodes time() function, combined with a minute cron, is it possible to run a query to delete logs over 24 hours? The time functions I still have not learned yet. 1 Quote Link to comment Share on other sites More sharing options...
TheMasterGeneral Posted July 5, 2016 Share Posted July 5, 2016 $Time=time(); $DeleteTime=$Time-86400; //86400 is 24 hours $db->query("DELETE FROM `table` WHERE `timestamp` <= {$DeleteTime}"); 1 Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted July 5, 2016 Author Share Posted July 5, 2016 TY! Needed that :) Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted July 6, 2016 Share Posted July 6, 2016 This can also be done as just the query $db->query('DELETE FROM `table` WHERE `timestamp` <= (unix_timestamp() - 86400)'); 2 1 Quote Link to comment Share on other sites More sharing options...
Sim Posted July 15, 2016 Share Posted July 15, 2016 Retarded to add that in a minute cron. I would use a daily cron personally. No less then a hourly cron. 2 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.