Ejemplo n.º 1
0
function PMBP_get_db_list($CONF)
{
    #global $CONF;
    // if there is given the name of a single database
    if ($CONF['sql_db']) {
        @mysqli_connect($CONF['sql_host'], $CONF['sql_user'], $CONF['sql_passwd']);
        if (@mysqli_select_db($CONF['sql_db'])) {
            $dbs = array($CONF['sql_db']);
        } else {
            $dbs = array();
        }
        return $dbs;
    }
    // else try to get a list of all available databases on the server
    $list = array();
    @mysqli_connect($CONF['sql_host'], $CONF['sql_user'], $CONF['sql_passwd']);
    $db_list = @mysqli_list_dbs();
    while ($row = @mysqli_fetch_array($db_list)) {
        if (@mysqli_select_db($row['Database'])) {
            $list[] = $row['Database'];
        }
    }
    return $list;
}
Ejemplo n.º 2
0
 public function list_dbs()
 {
     $this->check();
     return @mysqli_list_dbs($this->db);
 }
 function &MetaDatabases()
 {
     $qid = mysqli_list_dbs($this->_connectionID);
     $arr = array();
     $i = 0;
     $max = mysqli_num_rows($qid);
     while ($i < $max) {
         $db = mysqli_tablename($qid, $i);
         if ($db != 'mysql') {
             $arr[] = $db;
         }
         $i += 1;
     }
     return $arr;
 }