TheLostGuru Posted June 14, 2007 Share Posted June 14, 2007 Is it possible to have a table automatically clear its contents at a set time everyday? Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/ Share on other sites More sharing options...
Dragen Posted June 14, 2007 Share Posted June 14, 2007 I think you'll need to look into cronjobs. I haven't used them myself, but I thik it's what you want. Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/#findComment-274547 Share on other sites More sharing options...
aniesh82 Posted June 14, 2007 Share Posted June 14, 2007 call a function to clear your table function clearTable() { $sql = "TRUNCATE TABLE tablename"; } Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/#findComment-274548 Share on other sites More sharing options...
aniesh82 Posted June 14, 2007 Share Posted June 14, 2007 Hello, You need to set CRON to do this. To set CRON: please go to your control panel Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/#findComment-274550 Share on other sites More sharing options...
TheLostGuru Posted June 14, 2007 Author Share Posted June 14, 2007 Cronjobs eh... I'll look into those. Aniesh82, what exactly am I looking for in my control panel? Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/#findComment-274583 Share on other sites More sharing options...
aniesh82 Posted June 14, 2007 Share Posted June 14, 2007 Hello, are you using cpanel ? You can see one CRON TAB on cpanel. Regards Aniesh Joseph anieshjoseph@gmail.com Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/#findComment-274585 Share on other sites More sharing options...
smc Posted June 14, 2007 Share Posted June 14, 2007 Yeah you need Cron Jobs. Heres an example: 0 0 * * * GET http://myexampledomain.com/clear_table.php > /dev/null That will execute the PHP script at 12AM each morning. Google "Cron Job" or "Cron Jobs Syntax" to get more specific instructions on date and time setting. Also if you have trouble and know the format is right, contact your hosting provider and make sure they've authed you to use the GET daemon. Quote Link to comment https://forums.phpfreaks.com/topic/55569-automatically-clear-a-table/#findComment-274596 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.