What is mysql list dbs in PHP
In this article I am going to explain about mysql_list_dbs function in PHP.
PHP mysql_list_dbs() Function
The PHP mysql_list_dbs function is used to finds the available databases on a mysql server.
Syntax of mysql_list_dbs function
mysql_list_dbs(connection) |
Parameters in mysql_list_dbs function
It has only one parameter:
Parameter |
Description |
connection |
It specifies MySQL connection. |
Example of mysql_list_dbs function
<?php
$con=mysql_connect("localhost","gupta","sharad");
if(!$con)
{
die("Could not connect: ". mysql_error());
}
$dbList=mysql_list_dbs($con);
while($database=mysql_fetch_object($dbList))
{
echo $database->Database . "</br>";
}
mysql_close($con);
?>
|
Output:

You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here