Page 1 of 1

Listing all Tables in a MySQL Database

Posted: Sat Jan 18, 2003 6:25 pm
by Gen-ik
I've searched high and low for a way to do this but haven't found a clear example yet.

Could someone please let me know how I can read and list all of the Tables in a Database.. not the Table contents.. the actual Tables?

This would be a big help. Thanks.

Posted: Sat Jan 18, 2003 7:13 pm
by Gen-ik
Don't worry I've got it...

Code: Select all

<?php
$result=mysql_query("SHOW TABLES");

while($table=mysql_fetch_array($result))
{
echo("Table : ".$table[0]."<br>\n");
}
?>