I need to delete uploaded files from the server after 15 days using SQL.
How would I do that? The following is the current code, but it isn't working.
<?php
$con = mysql_connect("localhost","mt","mt");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("mt", $con);
function curdate(){
date_default_timezone_set ("Asia/Calcutta");
$cd=date("d/m/Y");
}
mysql_query("DELETE FROM mt_upload WHERE DateTime < DATE_SUB(curdate(), INTERVAL 1 DAY)
'");
mysql_close($con);
?>