CodeIgniter Forums

Full Version: database list
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I use this :

PHP Code:
        $this->load->dbutil();
        $dbs $this->dbutil->list_databases();

        foreach ($dbs as $db)
        {
            if ($this->dbutil->database_exists($db))
            {
                   echo $db."<br>";
            }
        

I don't understand, but it list all databases that I have (all, not just which I use in my application).

How to list the databases defined in the database.php (only) ?

Thanks a lot !!
(10-30-2019, 04:47 AM)Cognie Wrote: [ -> ]Hi,

I use this :

PHP Code:
        $this->load->dbutil();
        $dbs $this->dbutil->list_databases();

        foreach ($dbs as $db)
        {
            if ($this->dbutil->database_exists($db))
            {
                   echo $db."<br>";
            }
        

I don't understand, but it list all databases that I have (all, not just which I use in my application).

How to list the databases defined in the database.php (only) ?

Thanks a lot !!

@Cognie,

try this... 
Code:
$this->db->database;
Hi, 

Thanks,

PHP Code:
$this->db->database

echo the last database Confused  (I 4 databases in my application).