dennismonsewicz Posted September 23, 2009 Share Posted September 23, 2009 Is there anyway in PHP to retrieve the date in which a mysql table was created? Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/ Share on other sites More sharing options...
cahrehn Posted September 23, 2009 Share Posted September 23, 2009 show databases gives me the databases I've created, as well as "information_schema". In that database, there's a "tables," uhm, table. It's got info about all the databases and their tables, including a column called "create_time", which will tell you what you want. Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923546 Share on other sites More sharing options...
mattal999 Posted September 23, 2009 Share Posted September 23, 2009 Use this command instead: <?php $query = mysql_query("SHOW tablename STATUS") or die(mysql_error()); print_r(mysql_fetch_array($query)); ?> Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923548 Share on other sites More sharing options...
dennismonsewicz Posted September 23, 2009 Author Share Posted September 23, 2009 here is the code I am using: $t = mysql_query("SHOW users STATUS")or die(mysql_error()); print_r($t); This is the error I am getting: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'users STATUS' at line 1 Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923553 Share on other sites More sharing options...
mattal999 Posted September 23, 2009 Share Posted September 23, 2009 Sorry should be: $t = mysql_query("SHOW TABLE STATUS LIKE 'users'")or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923564 Share on other sites More sharing options...
dennismonsewicz Posted September 23, 2009 Author Share Posted September 23, 2009 hmmm now I am getting: Resource id #4 when I print_r the mysql_query query code $t = mysql_query("SHOW TABLE STATUS LIKE 'users'")or die(mysql_error()); print_r($t); Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923570 Share on other sites More sharing options...
Mark Baker Posted September 23, 2009 Share Posted September 23, 2009 hmmm now I am getting: Resource id #4 when I print_r the mysql_query You're clearly having a bad hair day $t = mysql_query("SHOW TABLE STATUS LIKE 'users'")or die(mysql_error()); while (($r = mysql_fetch_array($t)) !== false) { print_r($r); } Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923574 Share on other sites More sharing options...
dennismonsewicz Posted September 23, 2009 Author Share Posted September 23, 2009 lol dude you have no idea!!! tks! that worked! Link to comment https://forums.phpfreaks.com/topic/175226-solved-mysql-table-creation-date/#findComment-923577 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.