p.ross Posted December 5, 2005 Share Posted December 5, 2005 What is the code to echo the list of databases? I know in MySQL it's "SHOW DATABASES" but if you try to echo that query it's like systemresource #3 or something. Thanks. Link to comment https://forums.phpfreaks.com/topic/2989-echo-databases/ Share on other sites More sharing options...
ryanlwh Posted December 6, 2005 Share Posted December 6, 2005 are you trying to print mysql_query? you have to use mysql_result or mysql_fetch_xxx to get the rows before printing. the php alternative is mysql_list_dbs <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $db_list = mysql_list_dbs($link); while ($row = mysql_fetch_object($db_list)) { echo $row->Database . "\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/2989-echo-databases/#findComment-10035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.