Show last modified date from DB in PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bettina@coaster.ch

    Show last modified date from DB in PHP

    Is there a way to show in PHP automatic the date when a DB was last
    modified?

  • Jacob Atzen

    #2
    Re: Show last modified date from DB in PHP

    On 2005-07-04, bettina@coaster .ch <bettina@coaste r.ch> wrote:[color=blue]
    > Is there a way to show in PHP automatic the date when a DB was last
    > modified?[/color]

    I don't know of any way to get a database to tell you when it was last
    modified. You'll probably have to record the modification time manually.

    --
    Cheers,
    - Jacob Atzen

    Comment

    • usenet@isotopeREEMOOVEmedia.com

      #3
      Re: Show last modified date from DB in PHP

      On 4 Jul 2005 04:52:35 -0700, bettina@coaster .ch wrote:[color=blue]
      >Is there a way to show in PHP automatic the date when a DB was last
      >modified?[/color]

      In MySQL, I've accomplished this by adding a timestamp field to the table and
      sorting for the most recent value. In this case, it's called recupdated :

      $query = "SELECT DATE_FORMAT(rec updated, '%M %e, %Y %l:%i %p') AS datemod ";
      $query .= "FROM myTable ";
      $query .= "ORDER BY recupdated DESC LIMIT 1;";

      Then just echo datemod.

      But I'd be curious to find out if anyone else has an alternative ? As a real
      kludge, I suppose you could look at the file system modification time on the
      ..MYD or .MYI file. But that feels very wrong to me . . .

      Comment

      • Andy Hassall

        #4
        Re: Show last modified date from DB in PHP

        On 4 Jul 2005 04:52:35 -0700, bettina@coaster .ch wrote:
        [color=blue]
        >Is there a way to show in PHP automatic the date when a DB was last
        >modified?[/color]

        You'll have to define what a "DB" is and what constitutes a modification. The
        answer, in general, is no. It might be possible for specific databases. Most of
        the time you will have to add datetime fields to the data or tables or whatever
        you're monitoring and update them along with the other changes in some way.

        --
        Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
        <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

        Comment

        • Mladen Gogala

          #5
          Re: Show last modified date from DB in PHP

          On Mon, 04 Jul 2005 04:52:35 -0700, bettina wrote:
          [color=blue]
          > Is there a way to show in PHP automatic the date when a DB was last
          > modified?[/color]

          Most of the DB varieties usually have auditing facilities.

          --


          Comment

          Working...