PHP mysql_list_dbs() Function
Complete PHP MySQL Reference
Definition and Usage
The mysql_list_dbs() function finds the available databases on a MySQL server
for a given connection.
This function returns a result pointer containing the available databases
on success, or FALSE on failure.
Syntax
mysql_list_dbs(connection)
|
Parameter |
Description |
connection |
Optional. Specifies the MySQL connection. If not specified,
the last connection opened by mysql_connect() or mysql_pconnect() is used. |
Example
<?php
$con = mysql_connect("localhost", "peter", "abc123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_list = mysql_list_dbs($con);
while ($db = mysql_fetch_object($db_list))
{
echo $db->Database . "<br />";
}
mysql_close($con);
?>
|
The output of the code above could be:
Complete PHP MySQL Reference
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a fully functional free 30-day trial today!
|