Selecting Dynamic Database on user input - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Selecting Dynamic Database on user input (/showthread.php?tid=80686) |
Selecting Dynamic Database on user input - Dina_Az - 12-02-2021 Hi I am working on a system that lets users decide which database they want to use upon login. I want the user selected database to be used throughout the system. I store the user selected database value in session to later access it anywhere. I have tried following solutions: In model constructor: $selectedDb = $this->session->get_userdata('database'); $new_db_obj = $this->load->database($selectedDb); $this->db = $new_db; reason for doing $this->db = $new_db; I use $this->db->query() in all system and can't make changes everywhere if I do not do this. Please help me here if you can shagleazar. Thanks |