Hi all,
I am trying to use / change the database for different organizations / users. In master database, I have db_name for different organizations, I am using the following code to store the db_name in session.
in another model, switch the database
Its working in localhost but not on my live server.
Whats wrong here?
I am trying to use / change the database for different organizations / users. In master database, I have db_name for different organizations, I am using the following code to store the db_name in session.
Code:
$condition = "subdomain =" . "'" . $data['subdomain'] . "' AND " . "status =1";
$this->db->select('id, db_name');
$this->db->from('sublogin');
$this->db->where($condition);
$this->db->limit(1);
$db_name = $this->db->get()->row()->db_name;
// SET db_name for session
$this->session->set_userdata('db_name', $db_name);in another model, switch the database
PHP Code:
$db_name = $this->session->userdata('db_name');
$this->db->db_select($db_name);
Its working in localhost but not on my live server.
Whats wrong here?