CodeIgniter Forums
Connecting outside database - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Connecting outside database (/thread-27374.html)



Connecting outside database - El Forum - 02-09-2010

[eluser]E-Finity Internet[/eluser]
Hello,

I am currently developing a CMS on my local webserver with the settings of the loading CMS. When I import data from one site to change, I make a connection to an external database.

When I make contact with a website on the same server, so good. When I connect with a website wants to make another server, is wrong. Here I get an error page every time.

Currently I use the following code to connect to the database:

$website = $this->session->userdata('website');

Code:
$dsn = 'mysql://'.$website['db_user'].':'.$website['db_ww'].'@'.$website['db_host'].'/'.$website['db_name'].'?char_set=utf8&dbcollat=utf8_general_ci&cache_on=false';
        $this->second_db = $this->load->database($dsn,TRUE);        
        $this->load->helper('url');


On the remote server I host my data access to the database approach.

Can anyone give me an explanation for this, or should I in a different way?