faces3 Posted April 23, 2013 Share Posted April 23, 2013 How display all database in php checkbox / dropdown list where can choose what database connect. Quote Link to comment Share on other sites More sharing options...
Solution jugesh Posted April 23, 2013 Solution Share Posted April 23, 2013 <?php// Usage without mysql_list_dbs()$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');$res = mysql_query("SHOW DATABASES");while ($row = mysql_fetch_assoc($res)) { echo $row['Database'] . "\n";}// Deprecated as of PHP 5.4.0$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 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.