Welcome Guest, Not a member yet? Register   Sign In
using values from config in the db config file
#1

[eluser]cwpollock[/eluser]
I'm trying to centralize the change in configuration information into one file.

I want to set the db configuration along this lines

Code:
$db['default']['database'] = $this->config->item("db_name");

When I tried this it tells me that "this" is not available in this context.

Any thoughts on how to do this?
#2

[eluser]xwero[/eluser]
It seems a bit weird to import config settings in a config file. This also means there can only be one database group.

But a way to do it is just to include the one file, get the settings you need and destroy the rest
Code:
include(APPPATH'config/config.php');
$db = $config['db'];
unset($config);
#3

[eluser]cwpollock[/eluser]
Thanks that suits my purpose just fine.




Theme © iAndrew 2016 - Forum software by © MyBB