How to given the database name dynamically in codeigniter?


I have created the new database, new credential according to the emailid and mobile no is submit by user. I want to fetch the database name dynamically according to the root folder in codeigniter

Not sure what you are asking. Normally, you use your config file to set up a link to the database.
In this file, you assign a name to the database connections. Once this is done, the name you assigned
to it would be used throughout the rest of your code whenever you need to access the database.
The Codeigniter docs says:

CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). The config file is located at application/config/ database . php. You can also set database connection values for specific environments by placing database

Hope that helps.

The name of that database should be static, not dynamic. What are you trying to actually do, rather than how you are trying to do it?

Sponsor our Newsletter | Privacy Policy | Terms of Service