www.webdeveloper.com
Results 1 to 3 of 3

Thread: Delete data after 1 month

  1. #1
    Join Date
    Oct 2011
    Posts
    350

    Delete data after 1 month

    Hi...

    I have form of uploading data to the database, but I need to delete data after 1 month. how does it possibe.

    here is my query of insert data to the database:

    Code:
    $sql = "INSERT INTO sales_order (ProductType,WorkOrder,POIssueDate,SalesMonth) 
          VALUES 
          ('$ProductType','$WorkOrder','$POIssueDate','$SalesMonth')
          ON DUPLICATE KEY UPDATE
          ProductType = '$ProductType', WorkOrder = '$WorkOrder', POIssueDate = '$POIssueDate', SalesMonth = '$SalesMonth'" or die(mysql_error());
          mysql_query($sql, $con);
    Should I need to add fields for date upload?

    Thank you

  2. #2
    Join Date
    Nov 2002
    Posts
    2,632
    If the POIssueDate isn't the date it gets inserted, then you need to add a date for it. If you are on Linux/Unix hosting, you can run a cron job to delete the old data.

  3. #3
    Join Date
    Oct 2009
    Posts
    658
    Add another date LastModifiedDateTime defaulting to current timestamp. Run a cron or a windows scheduled task that would delete records you want
    Good Luck

    Santos Systems

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles