Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Read and Write Database Connection
#2

[eluser]majidmx[/eluser]
hi there,

You should specify two sets of DB configs :
Code:
$db['db_write']['hostname'] = "localhost";
$db['db_write']['username'] = "user";
$db['db_write']['password'] = "pass";
...

$db['db_read']['hostname'] = "localhost";
$db['db_read']['username'] = "user";
$db['db_read']['password'] = "pass";
...

and then in your model's code you have load them separately :

Code:
$this->DBr = $this->load->database('db_read', TRUE);
$this->DBw = $this->load->database('db_write', TRUE);

and then use it like this :


Code:
$db_result = $this->DBr->query('SELECT * FROM myTable');


Hope it helps,

MajiD


Messages In This Thread
[SOLVED] Read and Write Database Connection - by El Forum - 11-13-2009, 06:22 AM
[SOLVED] Read and Write Database Connection - by El Forum - 11-16-2009, 01:06 PM
[SOLVED] Read and Write Database Connection - by El Forum - 12-21-2009, 01:53 AM
[SOLVED] Read and Write Database Connection - by El Forum - 12-21-2009, 02:06 AM
[SOLVED] Read and Write Database Connection - by El Forum - 01-13-2010, 12:29 AM
[SOLVED] Read and Write Database Connection - by El Forum - 01-13-2010, 12:20 PM
[SOLVED] Read and Write Database Connection - by El Forum - 01-14-2010, 10:28 PM
[SOLVED] Read and Write Database Connection - by El Forum - 01-15-2010, 01:49 AM
[SOLVED] Read and Write Database Connection - by El Forum - 01-15-2010, 02:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB