Hey guys,
I understand how to setup the cron job to run once a day. Now I am having trouble putting together a function to do the following:
I need to delete all content (rows) automatically where the "expire_date" field is equal to or greater than todays date. Keep in mind I need a php file like (expire.php) to make my cron job execute, so it needs to delete all expired content.
I am still new to PHP, but I figure trying to do something like this will help me learn a bit faster.
So far I have something like:
function delete_expired() {
$current_date = date("m.d.y");
$sql = "DELETE * FROM cms_table WHERE delete_date => $current_date";
$res = mysql_query($sql) or die(mysql_error());
// NOT SURE WHAT TO PUT HERE, MAYBE AN IF STATEMENT? //
} // END delete_expired function
Any help would be greatly appreciated, thank you!