Forum Moderators: coopster
Oops, hold on, I thought you meant a particular field (column) in a certain table. You mean you want just the information for a certain table in the database...?
SHOW TABLE STATUS FROM mydatabase LIKE 'mytable';
$sql = "SHOW TABLE STATUS FROM mydatabase LIKE 'mytable'";
$rows = mysql_query [php.net]($sql);
$row = mysql_fetch_assoc [php.net]($rows);
print '<pre>';
print_r [php.net]($row);
print '</pre>';
I'm revisiting this topic having not yet gotten around to figuring it out. When I do the script above I can see the fields and everything, but can't seem to get them into an array so I can just extract the "Last Updated" record, and then output it as dd-Mmm-yy. How can I do this or do I need to alter the SQL query to just take out the one line I need?
SHOW TABLE STATUSquery. (We aren't querying a table with a date column in it).
Courtman, the result set is a single row returned as an array already, therefore there is no need to try and get them into an array, the data is already there. Run the previous short script and you'll notice the top line of output states Array. You need to do one of two things now, you could either format the date using another query statement (that doesn't retrieve any data from a table, but simply returns a formatted date), or you could use PHP to format the already returned date as Birdman alluded to earlier [webmasterworld.com]. Here is an example of the former, the latter is described in Birdman's post.
$sql = "SHOW TABLE STATUS FROM 45828_1 LIKE 'member'";
$rows = mysql_query($sql);
$row = mysql_fetch_assoc($rows);
$sql = "SELECT DATE_FORMAT('" . $row['Update_time'] ."', '%d %b %Y')";
$row = mysql_fetch_row(mysql_query($sql));
print $row[0];