SQL/PHP Query to delete records listed before today's date.

Posted on 2007-10-15
Last Modified: 2013-12-13

I currently have a VERY simple database storing fixtures from our PE department.  At the moment I have a page that allows people to add events, and another page that allows the to search for and delete events.  What I'm after is a page, or even an automatic script that deletes events after they have happened so that they're not still listed weeks and weeks afterwards.
Question by:llantwit
    1 Comment
    LVL 142

    Accepted Solution

    in MySQL, the query to run would be this:

    delete from yourtable where date_col < current_date()

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now