1. No Profile Picture
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Rep Power
    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?
    thank you

    great hope of palembang ,indonesia
  2. #2
  3. Wiking
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Sep 2000
    Rep Power
    First of all your logic is wrong here...

    The line
    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


Similar Threads

  1. mysql date time stamp and UTF8
    By doomish in forum MySQL Help
    Replies: 0
    Last Post: February 8th, 2004, 08:37 AM
  2. Select a mysql result date range with a drop down
    By horstuff in forum PHP Development
    Replies: 0
    Last Post: January 31st, 2004, 02:33 PM
  3. PHP MySQL $result from delete statement unexpected
    By bvdzwaag in forum PHP Development
    Replies: 4
    Last Post: January 23rd, 2004, 08:44 AM
  4. Creating a unique id based on date infomation
    By A_lix in forum MySQL Help
    Replies: 1
    Last Post: January 9th, 2004, 04:53 PM
  5. MySQL date problem
    By bobly in forum MySQL Help
    Replies: 3
    Last Post: January 7th, 2004, 09:10 PM

IMN logo majestic logo threadwatch logo seochat tools logo