boionfire81 Posted July 5, 2016 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
TheMasterGeneral Posted July 5, 2016 Posted July 5, 2016 $Time=time(); $DeleteTime=$Time-86400; //86400 is 24 hours $db->query("DELETE FROM `table` WHERE `timestamp` <= {$DeleteTime}"); 1 Quote
Magictallguy Posted July 6, 2016 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
Sim Posted July 15, 2016 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
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.