Welcome Guest, Not a member yet? Register   Sign In
retrieve the data in database.php file
#1

[eluser]Tamilmani[/eluser]
Hi All,

Anyone tell me how to retrieve the data's in database.php file( included in config folder)

Say example (in config.php)
ie . echo $this->config->item('language');

output: English


Similarly how to get the values for hostname, database etc from database.php

please its urgent for me ...

Help me give me the idea


thanks
Tamilmani Mohan
#2

[eluser]TheFuzzy0ne[/eluser]
There are two ways, depending on what you want to do:

1) If you just want the data for the current connection:

Code:
$username = $this->db->username;
$password = $this->db->password;
$hostname = $this->db->hostname ;
$database = $this->db->database ;
$dbdriver = $this->db->dbdriver ;
$dbprefix = $this->db->dbprefix ;

2) Just include the database config file, and the data should be available within the same scope that you called it:

Code:
include(APPPATH.'config/database'.EXT);
print_r($db);
#3

[eluser]Tamilmani[/eluser]
Thanks dude .....




Theme © iAndrew 2016 - Forum software by © MyBB