By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

How do I get the list of databases in PHP/MySQL?

P: 2
Hey in one of my allplication i want to retrieve all databases(using mysql presents in wamp) name in my combo box which is used in one of my form .
So pls help as soon as possible. I am using PHP and html only. I just want to retrieve names of databases present in wamp(phpmyadmin) to combobox.
If u find the solution pls contact me on ([removed --pbmods])
May 23 '07 #1
Share this Question
Share on Google+
3 Replies


ak1dnar
Expert 100+
P: 1,584
Hey in one of my allplication i want to retrieve all databases(using mysql presents in wamp) name in my combo box which is used in one of my form .
So pls help as soon as possible. I am using PHP and html only. I just want to retrieve names of databases present in wamp(phpmyadmin) to combobox.
If u find the solution pls contact me on ( vpchetan@gmail.com)
[PHP]<?php
$con = mysql_connect('localhost', 'root', 'dba');
$db_list = mysql_list_dbs($con);

$i = 0;
$counter = mysql_num_rows($db_list);
echo '<select name="dblist">';
while ($i < $counter)
{
$NAME = mysql_db_name($db_list, $i);
echo '<option value="'.$NAME.'">'.$NAME.'</option>';
$i++;

}
echo '</select>';
?> [/PHP]
May 23 '07 #2

ak1dnar
Expert 100+
P: 1,584
Please read the POSTING GUIDELINES next time.
Welcome to TSDN.
May 23 '07 #3

pbmods
Expert 5K+
P: 5,821
Changed thread title to better match contents.
May 23 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.