Jump to content

how to populate dropdown with database names and table names?


esandra

Recommended Posts

To show all databases

 

$con = mysql_connect("localhost","root","");
$result = mysql_query("show databases");
$db_str = "<select>";
$db_arr = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
//echo $row['Database']."<br>";
$db_str .= "<option>".$row['Database']."</option>";
$db_arr[] = $row['Database'];
}
$db_str .= "</select>";
echo $db_str;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.