Using two databases in a PHP + Codeigniter application

0

I know that this question has been asked before, but the ones I have been able to search for none helped me, I have a PHP + Codeigniter in> I have a select of the company I'm going to use the bank:

if ($this->input->post('empresa') === "emp1") {
   $this->db = $CI->load->database('default', TRUE);
} else {
   $this->db_emp2 = $CI->load->database('emp2', TRUE);
   $this->load->database('emp2');
}

I'd like to know if there's a way I can set Default-BD of every application after login, because it works in login , but when I query inside of the application it returns to another BD .

    
asked by anonymous 13.04.2018 / 13:22

0 answers