Jump to content

Cron job to delete data after 14 days


frank_solo

Recommended Posts

Not sure if I wrote this correctly but if anyone can just scan through this and let me know if it's fine. Thanks

 

<?php
$db_link=mysql_connect ("localhost", "", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("commercial"); 
$sql = "DELETE FROM `comm` WHERE `date_created` < DATE_SUB(NOW(),INTERVAL 14 DAY)";
$result2 = mysql_query($sql, $db_link);
?>

Link to comment
https://forums.phpfreaks.com/topic/249431-cron-job-to-delete-data-after-14-days/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.