record expire PHP / MySQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neal

    #1

    record expire PHP / MySQL

    I created a database that lets people post a job opening. I thought of
    manually removing each entry after 2 months, but is there some code that
    can do this without me having to monitor the table? Thanks.
  • frizzle

    #2
    Re: record expire PHP / MySQL

    If you're running Linux, you could consider a Cronjob that runs a
    script.

    Your jobs in the DB should also have a field with the creation date in
    it. Then the script executed by the cronjob checks where the date is
    older then 2 months ago and deletes those records...

    Cronjobs can be set weekly, daily, hourly, anything you want...
    I think this is the solution for you...

    Comment

    • Marcin Dobrucki

      #3
      Re: record expire PHP / MySQL

      Neal wrote:[color=blue]
      > I created a database that lets people post a job opening. I thought of
      > manually removing each entry after 2 months, but is there some code that
      > can do this without me having to monitor the table? Thanks.[/color]

      You could see how well triggers are now implemented in MySQL. It
      would make this job about one trigger in the DB without even involving
      PHP. But it might be that we will need to wait until v5.1

      http://dev.mysql.com/doc/mysql/en/create-trigger.html



      Comment

      • Jerry Stuckle

        #4
        Re: record expire PHP / MySQL

        Marcin Dobrucki wrote:[color=blue]
        > Neal wrote:
        >[color=green]
        >> I created a database that lets people post a job opening. I thought of
        >> manually removing each entry after 2 months, but is there some code
        >> that can do this without me having to monitor the table? Thanks.[/color]
        >
        >
        > You could see how well triggers are now implemented in MySQL. It
        > would make this job about one trigger in the DB without even involving
        > PHP. But it might be that we will need to wait until v5.1
        >
        > http://dev.mysql.com/doc/mysql/en/create-trigger.html
        >
        >
        >[/color]

        And what would kick off the trigger? You have to have some type of
        operation to get the trigger to run.

        IMHO, a cron job makes more sense.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • frizzle

          #5
          Re: record expire PHP / MySQL

          Can someone finally please tell me what IMHO means? :)

          Comment

          • Anonymous

            #6
            Re: record expire PHP / MySQL

            frizzle wrote:[color=blue]
            >
            > Can someone finally please tell me what IMHO means? :)[/color]

            In My Humble Opinion

            For all your abbreviation needs: http://www.acronymfinder.com/

            Comment

            • frizzle

              #7
              Re: record expire PHP / MySQL

              ah, LOL! ;)

              Comment

              Working...