query($sql);
while ($row = $result->fetch_assoc()) {
$id = $row['id'];
$req_id = $row['req_id'];
$doc_id = $row['doc_id'];
$temp = $row['temp'];
$deleted = $row['deleted'];
$uid = $row['uid'];
$exp_date = $row['exp_date'];
$current_date = strtotime(date('Y-m-d'));
if ($current_date > strtotime($exp_date)) {
echo "Current Date: " . date('Y-m-d', $current_date) . "
";
echo "Expiration Date: " . $exp_date . "
";
if (file_exists($temp)) {
echo "File exists: " . $temp . "
";
if (unlink($temp)) {
echo "File deleted successfully.
";
// Update the deleted column for this specific row
$updateSql = "UPDATE file_expire SET deleted = 1";
if ($conn->query($updateSql) === TRUE) {
echo $id . "
";
echo "Deleted column updated successfully.
";
} else {
echo "Error updating deleted column: " . $conn->error . "
";
}
} else {
echo "Failed to delete the file.
";
}
} else {
echo "File does not exist: " . $temp . "
";
}
}
}
?>