Canman2005 Posted October 24, 2009 Share Posted October 24, 2009 Hi all I have the following <?php $sql = "SHOW TABLES"; $result = mysql_query($sql); while ($row = mysql_fetch_row($result)) { echo "Table: {$row[0]}\n<br>"; } ?> Which outputs Table: admins Table: users Table: people This is great, but I wonder if it's possible to do these 2 things; 1: Rather than displaying the table name such as "admins", it would display the "table comments", so it would look like Table: Table of administrators Table: Table of site users Table: Table of people 2: Is it possible to tell it to exclude specified tables, such as not displaying the "admins" table? So if I excluded the "admins" table it would finally look like Table: Table of site users Table: Table of people Any help would be great, been searching Google for ages now with no luck Thanks in advance Dave Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 24, 2009 Share Posted October 24, 2009 $ignoreList = array('admins'); $query = "SHOW TABLE STATUS"; $result = mysql_query($query); while($record = mysql_fetch_assoc($result) { if(!in_array($record['Name'], $ignoreList)) { echo "Table: {$record['Comment']}<br />\n"; } } Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted October 24, 2009 Author Share Posted October 24, 2009 thanks 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.