Jump to content

[SOLVED] Accessing database table's last update information


soycharliente

Recommended Posts

The time.

 

I see this when I choose a table to view.

Row Statistics

Statements  Value

Format dynamic

Rows 2

Row length ø 154

Row size ø 2,202 Bytes

Next Autoindex 3

Creation Feb 28, 2007 at 09:23 AM

Last update Apr 10, 2007 at 04:40 PM

 

I want that "Last update" info.

Link to comment
Share on other sites

Simple SQL

 

SELECT * FROM tablename ORDER BY Lastupdate DESC LIMIT 1

 

he doesn't have a column in his table that updates the time whenever anything else is updated. that would be the obvious addition to his code, but i was researching another way, if there was one. phpMyAdmin seems to do this automatically.

Link to comment
Share on other sites

So are we saying that there is no function available to get that information and that I should just add another field to update what time the row was added/changed?

 

I want the information to be able to see when the last update to certain tables was (i.e. some information changed on the site).

 

Just seems like that's a lot to do for something so simple. Adding another field, making sure you set it every time it gets update, setting it initially when creating it, and returning it by ORDER BY foo LIMIT 1. Wish there was a returnLastUpdate($db, $table) function.

Link to comment
Share on other sites

$sql = "show table status";

$result = mysql_query($sql);

while ($row = mysql_fetch_array($result)) {
      print "Last update time for table " . $row['Name'] . " was " . $row['Update_time'] . "<br />";
}

 

Perhaps that helps?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.