PHP – List All Tables of a Database

The given PHP example helps you to list the all tables of a database.

Code Example:
<?php
$hostname="localhost";
$username = "root";
$password = "root";
$conn = mysql_connect($hostname,$username, $password) or die ("Unable to connect to database!");

$tables = mysql_list_tables("school");
while (list($table) = mysql_fetch_row($tables)) {
    echo "$table <br />";
}
?>

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *