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 Link to comment https://forums.phpfreaks.com/topic/178807-solved-show-tables-help/ 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"; } } Link to comment https://forums.phpfreaks.com/topic/178807-solved-show-tables-help/#findComment-943357 Share on other sites More sharing options...
Canman2005 Posted October 24, 2009 Author Share Posted October 24, 2009 thanks Link to comment https://forums.phpfreaks.com/topic/178807-solved-show-tables-help/#findComment-943429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.