Select multiple databases with PDO
===

I have a `functions.php` file that has one `PDO` Connection i use to access the database and all that good stuff it's this one: <br/>

    $host = "localhost";
    $db = "maindatabase";
    $adminuser = "admin";
    $adminpw = "123456";
    global $connection;
    	
    $connection = new Connection($host,$adminuser,$adminpw,$db);

And i `require` this script on every file that needs to access to the database, the thing is in some cases i want to change from `$db = "maindatabase";` to `$db = "anotherdb";` and i know i can do it with just a setter<br/>

    $connection->setDatabase("anotherdb");

But since i `require` the `functions.php` file into every other file i don't know if it will overwrite itself back to default, does anybody knows how can i change it and make it stay ?