Welcome Guest, Not a member yet? Register   Sign In
Set DB configuration outsite the database config file
#1

[eluser]E-Finity Internet[/eluser]
Hello,

I have in my database config-2 are different databases. The 2nd database is to make use of variable data. These data come from my config database.

Is it possible to model the user / host name and password set?

I use the following:

<?php
class Pagemodel extends Model
{
private $second_db;

function __construct()
{
parent::__construct();
$this->second_db = $this->load->database('extern', TRUE);
}
}
?>

This works fine, but i want somthing like this:

<?php
class Pagemodel extends Model
{
private $second_db;

function __construct()
{
parent::__construct();
$this->second_db->host = 'localhost';
$this->second_db->username = 'testuser';
$this->second_db->password = 'password';
$this->second_db->dbname = 'testdb';
$this->second_db = $this->load->database('extern', TRUE);
}
}
?>

Is this possible in CI?




Theme © iAndrew 2016 - Forum software by © MyBB