Welcome Guest, Not a member yet? Register   Sign In
Can I fetch database info from config.php?
#1

[eluser]chefnelone[/eluser]
Hello.

Just this, Can I grab some database stored information from within config/config.php.

something like:


Code:
$config['language']    = 'here I fetch the data from the database table';

//instead of:

$config['language']    = "french";

thanks
#2

[eluser]mddd[/eluser]
Not through CI, because the config file is read before the database connection is available.
You could manually connect to the database and do a query. But I think config.php is the wrong place to do that.
Better make a model or even a hook to do that kind of thing, and keep config.php just for simple configuration values.
#3

[eluser]chefnelone[/eluser]
[quote author="mddd" date="1276009886"]Not through CI, because the config file is read before the database connection is available.
You could manually connect to the database and do a query. But I think config.php is the wrong place to do that.
Better make a model or even a hook to do that kind of thing, and keep config.php just for simple configuration values.[/quote]
thanks
will take your advice




Theme © iAndrew 2016 - Forum software by © MyBB