Welcome Guest, Not a member yet? Register   Sign In
Setting Database username outside config file
#1

[eluser]E-Finity Internet[/eluser]
Hi there,

In my CMS system I want to exucute a query on another database. For this I want the 2nd table variable through the username and password from a database table to retrieve another.

Can you set outside the database config a username and password?

Kind Regards,

Raymond Veldhuizen
#2

[eluser]rogierb[/eluser]
Yes you can, its all in the user guide: Connecting to your Database

You can connect to as many databases as you want by using the connection array
#3

[eluser]E-Finity Internet[/eluser]
[quote author="rogierb" date="1259089459"]Yes you can, its all in the user guide: Connecting to your Database

You can connect to as many databases as you want by using the connection array[/quote]
Ok, i had tried.

The following i have:

$dsn = 'mysql://my_username:my_pass@host/table';
$this->second_db = $this->load->database($dsn, TRUE, TRUE);

For the config of my System i had to keep the default DB.

When is use this config, i had the next error:

Fatal error: Call to a member function result_array() on a non-object in (root of my website) on line 24




Theme © iAndrew 2016 - Forum software by © MyBB