In the past, I just create a new database to every apps I made. Recently, I try to connect to a PostgreSQL using a different schema in one database. Using ADODb, it’s relatively easy to connect:

try {
    $DB->Connect("host=localhost port=5432 dbname=my_db user=my_user password=my_secret options=--search_path=my_schema);
} catch (exception $e) {
    //var_dump($e);
    echo 'Cannot connect';
}
Advertisements