CodeIgniter Forums
Multiple Database Files are not loading - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Multiple Database Files are not loading (/showthread.php?tid=47780)



Multiple Database Files are not loading - El Forum - 12-21-2011

[eluser]web_developer[/eluser]
Hi,

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 www.project.com/blog <-- It should connect to blog database
If URL is like www.project.com/common <-- It should connect to common database
If URL is like www.project.com <-- 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 !!!