Welcome Guest, Not a member yet? Register   Sign In
Selecting Dynamic Database on user input
#1

(This post was last modified: 12-12-2021, 09:07 PM by Dina_Az.)

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB