esandra Posted February 9, 2011 Share Posted February 9, 2011 I'm using mysql and php..I'd like to see how the query should go if I want to display the existing database names on a dropdown, same thing with the table names Link to comment https://forums.phpfreaks.com/topic/227108-how-to-populate-dropdown-with-database-names-and-table-names/ Share on other sites More sharing options...
anups Posted February 9, 2011 Share Posted February 9, 2011 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; Link to comment https://forums.phpfreaks.com/topic/227108-how-to-populate-dropdown-with-database-names-and-table-names/#findComment-1171724 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.