schutzy Posted May 25, 2006 Share Posted May 25, 2006 Hello All,I am (attempting to write) writing an admin web interface for a CMS and as usual my first hurdle that I have to jump appears on the first line of real code...:(The admin's function is to allow simple database management for multiple mysql databases via a browser. The issue that I am having right now is that I am trying to retrieve the names of all of the mysql databases that have been created. Using the command line this is a simple SHOW DATABASE; However, the mysql_query doesn't return any values. Here's the code: $dbquery = mysql_query("SHOW DATABASES;");$i = 0;while ($row = mysql_fetch_assoc($dbquery)) { $arr[$i] = $row['post_title']; echo "<br> $i=$arr[$i]"; $i++ ;}This is probably a stupid post but what the heckSchutzy Link to comment https://forums.phpfreaks.com/topic/10400-php-show-databases/ Share on other sites More sharing options...
Crimpage Posted May 25, 2006 Share Posted May 25, 2006 Change $arr[$i] = $row['post_title'];to $arr[$i] = $row['Database'];Otherwise, I just copied and pasted your code and all worked fine. Link to comment https://forums.phpfreaks.com/topic/10400-php-show-databases/#findComment-38793 Share on other sites More sharing options...
Prismatic Posted May 25, 2006 Share Posted May 25, 2006 This works for me, returns all the databases on the server...[code]$dbquery = mysql_query("SHOW DATABASES");$i = 0;while ($row = mysql_fetch_assoc($dbquery)) { $arr[$i] = $row['Database']; echo "<br> ". $i ." = " .$arr[$i]; $i++;}[/code] Link to comment https://forums.phpfreaks.com/topic/10400-php-show-databases/#findComment-38814 Share on other sites More sharing options...
schutzy Posted May 25, 2006 Author Share Posted May 25, 2006 Thanks All!I'm testing it right now...Schutzy Link to comment https://forums.phpfreaks.com/topic/10400-php-show-databases/#findComment-38957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.