Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Dinamically re-set DB connection
  • I would re-set the DB connection parameters from a file in the root directory (like db.php) Exists a configuration that permit to add a path where search db connections or can I re-set the connection dinamically passing the configuration array included from DOCROOT . 'db.php'? like
    'type'        => 'pdo',
    'connection'  => array(
     'persistent' => false,
     'dsn'        => 'mysql:host=localhost;dbname=database_name',
     'username'   => 'root',
     'password'   => 'root_password',
    ),
    

    thank you!
  • You can create a custom instance:
    $db = \Database_Connection::instance('customname', $configarray);
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion