I'm planning on adding destroyable messages to my website. I want users to choose how long the message should be 'alive'. The message should be destroyed a specific time after creation only if the row meets a column value.
The important columns are:
time, destroy
time is stored as DATETIME in the database.
I want a row to be deleted 1 hour after creation only if destroy equals '1'
I'd highly appreciate it if someone could point me in the right direction as I have no clue on how to approach this.
Thanks in advance
I've read about using cron jobs but I failed to do so.
This is what i've tried:
cron.php
<?php
include 'includes/db.php';
mysql_query("DELETE FROM `d_msg_enc` WHERE `mode` = 1 AND `time` > DATE_SUB(NOW() INTERVAL 10 MINUTE)");
?>