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. Quote 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/2989-echo-databases/#findComment-10035 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.