eon201 Posted November 16, 2007 Share Posted November 16, 2007 Hi, I want to get the time/date that a table was last updated within my database. I know you can put a new column in with a timestamp, but the data is old and obviuosly already exists. I notice that in my mysql admin it shows me this time and date. Is there anyway I can grab this and display it in my html page with php?? Thanks guys. Eon201 Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 16, 2007 Share Posted November 16, 2007 I've heard of of a mysql_insert_id () function but not what you want maybe the gurus in the forum can help you Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 16, 2007 Share Posted November 16, 2007 SHOW TABLE STATUS http://dev.mysql.com/doc/refman/5.0/en/show-table-status.html There's a return value for Update_time Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 16, 2007 Share Posted November 16, 2007 very nice mjdamato learnt another thing today after 4 years of programming in php Quote Link to comment Share on other sites More sharing options...
eon201 Posted November 16, 2007 Author Share Posted November 16, 2007 Hey thanks! Sorry to be a pain/noob, but how would I implement the Update_time into this function??? Thanks. Eon201 Quote Link to comment Share on other sites More sharing options...
eon201 Posted November 16, 2007 Author Share Posted November 16, 2007 Ok, ive tried it like this... $mysqlupdate = mysql_query("SHOW TABLE STATUS FROM logtable;"); echo "Statistics last updated - $mysqlupdate[update_time]"; But no luck Have I messed up the syntax??? Quote Link to comment Share on other sites More sharing options...
pkSML Posted November 16, 2007 Share Posted November 16, 2007 Your code needs to look something like this: $result = mysql_query("SHOW TABLE STATUS FROM table_name;"); while($array = mysql_fetch_array($result)) { print_r($array); // Will print information about each table stored in database } $result returns a resource. You need to use one of the mysql php functions to use it. BTW, I'm using InnoDB for my tables, and unfortunately it doesn't record a last update time. Quote Link to comment Share on other sites More sharing options...
eon201 Posted November 22, 2007 Author Share Posted November 22, 2007 Hey guys, Thanks for all of the help so far on this. Unfortuantly none of the suggested examples work! Has anyone else achieved this before?? Or has any idea on how to go about it? Thanks, eon201 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.