|
| |
PHP MySQL Functions to list databases |
By using mysql_db_list() function we can get the result set and by using a pointer to this result set we can get the list of all the database. With this and using the code below we can list all the databases hosted on the mysql server. Here is the code, ensure that connection is available to the server.
<?
$list_of_dbs = mysql_list_dbs();
$i = 0;
$total = mysql_num_rows($list_of_dbs);
while ($i < $total) {
echo mysql_db_name($list_of_dbs, $i) . " ";
$i++;
?>
| |
|
|
|