Here's what I have: $date = EXPIRATION DATE (from DB); $today = date("m/d/y"); If today is past the expiration date which is listed, it removes it from the database. How can I set this up? Thanks
You can use cron jobs, here is a tutorial for you : http://www.sitepoint.com/article/introducing-cron
You could simply use: if $date = $today { mysql_query('TRUNCATE TABLE tbl_name') or die(mysql_error()); } PHP: I think..? It's been a long time since i've coded anything to be honest =[ Chuckun
I could use Cronjobs but how could I set it up? Thanks Chuckun but if $date = $today isn't exactly right since it's on the POST page, where if the posted date is before today it'd also return an error and delete it.
if ($date < time()) { // delete } if (strtotime($date) < time()) { // delete } PHP: First one if the date in the db is a timestamp, second one if its something like 08-08-2000 02:34:06
Thanks decepti0n. Rep added. Now another question. Once the thing goes out of date, it needs to be removed once a script is run and delete from MySQL. How's a good way to do it? Thanks!
Instead of a cron job, you could simply have the code run each time a page is loaded. Have it check the date and delete any rows from the database which have expired. Or, even better - you could use a few lines of code so the script is only executed once a day (Saves from having to setup the cron jobs)