codeigniter-base-model
codeigniter-base-model copied to clipboard
Specify a database connection on a per-model basis by declaring instance variable
trafficstars
The class will automatically use the default database connection, and even load it for you if you haven't yet.
You can specify a database connection on a per-model basis by declaring the _$database instance variable. This is equivalent to calling $this->db->database($this->_database, TRUE).
class Post_model extends MY_Model
{
public $_database = 'group_name';
}