Delete Data fom Mysql After 24hrs

mysql, php

Solution

DELETE FROM counter_ads WHERE time < NOW() - INTERVAL 24 HOUR

You could also consider automating such a process using MySQL's event scheduler, if so desired.

Problem

hello i am working on a database where i want to delete data which is 24hrs old ... and i am using now() to insert data ..... here is my insert code ``` INSERT INTO counter_ads (page,ip,time) VALUES ( '$page', '$ref', NOW()) ``` can any one help i want if time column is old than 24hrs it should get delete ... with mysql query. i want something like ``` DELETE FROM counter_ads WHERE NOW()-24 > time ``` i know this will not work but something like this thx

Original source