Welcome Guest, Not a member yet? Register   Sign In
Multiple Database Files are not loading
#1

[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 !!!




Theme © iAndrew 2016 - Forum software by © MyBB