Hi
One of my tables has a timestamp which identifies the time and date the record was inserted into the database (timestamp is PHP Generated).
I require to delete records that are one month old everytime the table is accessed, just wondering, how can I calculate this?
Anything would help here
Many thanks
Muzz
Timestamp values
Moderator: General Moderators
This should do it:
Code: Select all
<?PHP
$prev_month = strtotime("-1 month");
$query = "DELETE FROM my_table WHERE timestamp < '$prev_month'";
?>Real programmers don't comment their code. If it was hard to write, it should be hard to understand.