Posted By

neogeek on 07/01/06


Tagged

mysql database


Versions (?)

Who likes this?

20 people have marked this snippet as a favorite

jleblanc
jonbaer
Fixe
n2linux
hxseven
blakeb
Hollow
demods
Phoenix
vali29
motoroller
digiloper
Oishiiii
nb109
umang_nine
DreamOn
kaartz
g33kish
bobbym245
lfcortes


MySQL List Databases


 / Published in: PHP
 

Fetch a list of available databases.

  1. if (!function_exists('mysql_list_databases')) {
  2.  
  3. function mysql_list_databases($resources = Array()) {
  4.  
  5. $list = Array();
  6.  
  7. for ($i = 0; $i < count($resources); $i++) {
  8.  
  9. $dbs = @mysql_list_dbs($resources[$i]);
  10.  
  11. while ($row = @mysql_fetch_object($dbs)) {
  12. if ($row->Database != 'information_schema') { $list[] = $row->Database; }
  13. }
  14.  
  15. }
  16.  
  17. return $list;
  18.  
  19. }
  20.  
  21. }

Report this snippet  

You need to login to post a comment.