Welcome Guest, Not a member yet? Register   Sign In
Call Database records into config file.
#1

[eluser]sivakarthick[/eluser]
Any body can help me to solve this problem?

I want to call a database table records into config.php. How can I do this? Is there any proper way to do this?

Please help me.

Thanks in adavance.

Karthick
#2

[eluser]InsiteFX[/eluser]
You need to explin your problem better so we can help you!

InsiteFX
#3

[eluser]sivakarthick[/eluser]
I want to load $config['language'] = "english" from database table. How can I do it?

Got it?
#4

[eluser]bubbafoley[/eluser]
The config gets loaded way before the database ever will be. The easiest way to do it would probably be set up a MY_Controller and change the config language there.

Code:
<?php

class MY_Controller extends CI_Controller {
    
    public function __construct()
    {
        parent::__construct();
        $lang = $this->lang_model->get_lang_from_db();
        $this->config->set_item('language', $lang);
    }
    
}

Then in your controllers you can load lang files normally
Code:
class Welcome extends MY_Controller {

    function index()
    {
        $this->lang->load('my_custom');
    }

}




Theme © iAndrew 2016 - Forum software by © MyBB