Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    Bunbury W.A
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to delete record after x days

    Any one suggest how I get my code to automatically delete all records in the d/b that are older than x days, and how should I implement this code in my site? ie where would this code be inserted?
    Or should I just filter the records by date and let them all build up in the database?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Northern NJ
    Posts
    404
    Thanks
    0
    Thanked 1 Time in 1 Post
    How are you keeping track of how old a record is? By a seperate field? if so you can use 'Now()' which is today's date and if a date is older than X days old call your delete routine.

    use:

    DateDiff("d", nameofrecord, Now())

    which gives you back a number and if that number is greater than or equal to the number X days delete that entire record

    if you need me to give code I will, but I don't think I need to
    I would rather be a lion for a day than a lamb that lives forever.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Bunbury W.A
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    where we put code

    Ok thats helpfull, thanks, where exactly would one insrt this code in regards to the entire site? I dont want to compamise speed on the front page, is there a way of automatically calling a routine based on time of DAy? say have a seperate page run automacally every day.

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes it is.
    See the thread : schedduling executions.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •