CodeIgniter Forums

Full Version: Multiple Database Files are not loading
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


I have multiple database file in main "config" folder, it's like below structure

Quote:| config
- database.php
- database_common.php
- database_blog.php

Now, I have different controllers which is like below.

Quote:| controllers
- general.php
- blog.php
- common.php

Now I want to connect database according to controllers

for example

If URL is like <-- It should connect to blog database
If URL is like <-- It should connect to common database
If URL is like <-- It should connect to general database

for that In my "general" controller, I have put this line for loading database "$this->load->database();"
it's working perfectly

in "blog" controller I have put like "$this->load->database_blog()" <-- This is not working
Same case for "common" controller like "$this->load->database_common()" <-- This is also not working

It's giving me Fatal Error like below...

Fatal error: Call to undefined method MY_Loader::database_blog()

in all database files all variables and everything is same, Just user,pass and DB name are different.

How can I load this database files? can anyone help me out !!

Thanks in advance !!!