Re: Periodically delete old records from mysql table

From: Date: Tue, 27 May 2008 12:16:52 +0000
Subject: Re: Periodically delete old records from mysql table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-274723@lists.php.net to get a copy of this message
i'm wandering if there's some intelligent way to delete old records from a mysql table without using cronjobs (i can't), using PHP. This table has a field which stores the value returned from time(), and i want to do mysql_query("DELETE FROM table WHERE time<='".(time()-86400)."'");
You could have it triggered manually, or by your website say. Or you could (if you have it) use a cron job on another machine. You must of course be able to connect to MySQL remotely from this box if you choose that route. Depending on your MySQL version triggers may be able to do it too - but I've not used these so I couldn't say for sure. -- Richard Heyes In Cambridge? Employ me http://www.phpguru.org/cv +----------------------------------------+ | Access SSH with a Windows mapped drive | | http://www.phpguru.org/sftpdrive | +----------------------------------------+

« previous php.general (#274723) next »