October 24th, 2000, 02:00 AM
i want to delete myads using expire date,based on scripts;
$sql="delete from data where ??????
i dont know how to delete my dataon mysql server using php,or how to do it,do i have to add column date and compare it?
are mysqldate and php date understanding each other how tocombine them on such operation above?
great hope of palembang ,indonesia
October 24th, 2000, 03:56 AM
First of all your logic is wrong here...
will never be true since $today = current time and $expire_date is current time + 120 days.
I don't know how myads works, so this might be totally wrong, but to hopefully help you get things going:
Use a table with a column for expire date, which is set when you add things to your table (ie $expire_date=time()+(86400*120)). When you're about to delete things from this table, you compare the stored expire_date with $today=time(), and if this evaluates true, you can delete it with $sql="delete from data where expire_date<=$today".
Check the manual for what format to use when storing expire_date and comparing the dates, but I would use timestamp and MySQLs built in functions for time, like now(), sysdate() etc.
Hope I made some sense here