<html>
<head>
<title>Listing the databases available in a connection</title>
</head>
<body>
<?php
$user = "java2s";
$pass = "password";
$link = mysql_connect( "mysql153.secureserver.net", $user, $pass );
if ( ! $link )
die( "Couldn't connect to MySQL" );
$db_res = mysql_list_dbs( $link );
$num = mysql_num_rows( $db_res );
for( $x = 0; $x < $num; $x++ )
print mysql_tablename( $db_res, $x )."<br>";
mysql_close( $link );
?>
</body>
</html>
|