I had a big portal in Codeigniter in which user can register and they can comment on each products, they can create their profiles, a forum ( custom made ) connected to this etc...
Also the company's main products also stored in the same DB.
The requirements is since the products tables are mpre important than users, now its some difficult for back up and all, I mean we have to split the database into two. ie one for users and their activities and other for main products.
I am bit confused to connect 2 dbs in a single codeigniter because we have to call/fetch data from both db's in a view / model
Any ideas ?
From here:
http://ellislab.com/codeigniter/user-guide/general/models.html#loading
When a model is loaded it does NOT connect automatically to your database. The following options for connecting are available to you:
You can connect using the standard database methods described here, either from within your Controller class or your Model class. You can tell the model loading function to auto-connect by passing TRUE (boolean) via the third parameter, and connectivity settings, as defined in your database config file will be used:
$this->load->model('Model_name', '', TRUE);
You can manually pass database connectivity settings via the third parameter:
$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = FALSE;
$config['db_debug'] = TRUE;
$this->load->model('Model_name', '', $config);