I have search and tried all codes I could find to try to delete certain rows based on an 8hr interval from current time but it is not working. I put it in the header and in other pages. here is my code:
`date_default_timezone_set('Country/City');
if (isset($_SESSION["login"])) {
$display = $_SESSION["login"];
$day_nudge = mysqli_query($conn,"DELETE FROM nudges WHERE nudge_time < DATE_ADD(NOW(), INTERVAL -8 HOUR)");
}`
I have also tried other ways such as:
DELETE FROM nudges
WHERE nudge_time < (NOW() - INTERVAL 8 HOUR)
DELETE FROM nudges
WHERE nudge_time < DATE_SUB(NOW(), INTERVAL 8 HOUR)
these all worked on local host but now its on my server it does not execute.