List Database and tables in PHP:
<?php
$connection = @mysql_connect(“localhost”,”root”,”root”) or die(mysql_error());
$dbs = @mysql_list_dbs($connection) or die(mysql_error());
$db_list = “<ul>”;
$i = 0;
while ($i < mysql_num_rows($dbs))
{
$db_names[$i] = mysql_tablename($dbs,$i);
$db_list .= “<li>$db_names[$i]”;
$tables = @mysql_list_tables($db_names[$i]) or die(mysql_error());
$table_list = “<ul>”;
$j = 0;
while ($j < mysql_num_rows($tables))
{
$table_names[$j] = mysql_tablename($tables, $j);
$table_list .= “<li>$table_names[$j]”;
$j++;
}
$table_list .= “</ul>”;
$db_list .= “$table_list”;
$i++;
}
$db_list .= “</ul>”;
?>
<h1>Database Names </h1>
<? echo $db_list; ?>