phpmady Posted May 30, 2010 Share Posted May 30, 2010 Hi, I want to delete the row in the table, based on the expiration of the date. for example ::now i have id name date 1 xxxx 30.05.10 2 yyyy 31.05.10 what i want is, today 30.05.10 so i want to have only 1 row i.e id name date 2 yyyy 31.05.10 Thanks Link to comment https://forums.phpfreaks.com/topic/203358-delete-the-table-row-automatically/ Share on other sites More sharing options...
ohdang888 Posted May 30, 2010 Share Posted May 30, 2010 You'll need to set up a CronJob on your server to call a file on your server that will have a DELETE query http://en.wikipedia.org/wiki/Cron You can set the cronJob to go off at midnight every night to delete the days rows.... though i don't udnerstand why you would want to do this? unless the table is just getting huge, why not keep them and use WHERE clauses with your SELECT queries Link to comment https://forums.phpfreaks.com/topic/203358-delete-the-table-row-automatically/#findComment-1065375 Share on other sites More sharing options...
phpmady Posted May 30, 2010 Author Share Posted May 30, 2010 You'll need to set up a CronJob on your server to call a file on your server that will have a DELETE query http://en.wikipedia.org/wiki/Cron You can set the cronJob to go off at midnight every night to delete the days rows.... though i don't udnerstand why you would want to do this? unless the table is just getting huge, why not keep them and use WHERE clauses with your SELECT queries thanks for your suggestion, that means how to write the select query for that am having my date in unix timestamp thanks Link to comment https://forums.phpfreaks.com/topic/203358-delete-the-table-row-automatically/#findComment-1065378 Share on other sites More sharing options...
ohdang888 Posted May 30, 2010 Share Posted May 30, 2010 easiest way to do it is to make another column that has the date in the format you said u did (31.05.10) $day = date('d.m.y'); $query = "SELECT * FROM table_name WHERE day='$day' "; Link to comment https://forums.phpfreaks.com/topic/203358-delete-the-table-row-automatically/#findComment-1065391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.