$connection = @mysql_connect("mysql153.secureserver.net", "rntsoft", "password") or die(mysql_error());
//get database list
$dbs = @mysql_list_dbs($connection) or die(mysql_error());
//start first bullet list
$db_list = "";
$db_num = 0;
while ($db_num < mysql_num_rows($dbs)) {
$db_names[$db_num] = mysql_tablename($dbs, $db_num);
$db_list .= "- $db_names[$db_num]";
//get table names and start another bullet list
$tables = @mysql_list_tables($db_names[$db_num]) or die(mysql_error());
$table_list = "";
$table_num = 0;
while ($table_num < mysql_num_rows($tables)) {
//get table names and make each a bullet point
$table_names[$table_num] = mysql_tablename($tables, $table_num);
$table_list .= "- $table_names[$table_num]";
$table_num++;
}
$table_list .= "
";
$db_list .= "$table_list";
$db_num++;
}
$db_list .= "
";
?>
MySQL Tables
Databases and tables in a MySQL database:
echo "$db_list"; ?>