Name
mysql_list_dbs
Synopsis
qresource mysql_list_dbs([cresource connection
])
Returns a
query resource handle that can be used to retrieve the names of the
databases available on a connection; the database names are retrieved
with a subsequent call to mysql_db_name( )
. An
optional connection
resource handle may be
provided as the parameter; otherwise, the most recently opened
connection that is still open is assumed.
Returns false
on error.
Example
<?php $connection = mysql_connect("localhost", "fred", "shhh"); mysql_select_db("wedding", $connection); $result = mysql_list_dbs($connection); echo "The databases available are:\n"; for ($x=0; $x < mysql_num_rows($result); $x++) echo mysql_db_name($result, $x) . "\n"; ?>
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.