Welcome Guest, Not a member yet? Register   Sign In
selecting databse name at login time
#1

[eluser]Unknown[/eluser]
Hi Every one

Can i use $_POST['dabname'] in side the ./conifg/database.php .

because i want to select database name at login time. with this login information i want to connect to different databse.

if usgae of $_post[] is wrong way. can u tell me the solution to my problem

Thanks in Advance
#2

[eluser]Bl4cKWid0w[/eluser]
Try using this:

Code:
if($this->form_validation->run() == FALSE){
     $config['hostname'] = "localhost";
     $config['username'] = "myusername";
     $config['password'] = "mypassword";
     $config['database'] = "mydatabase";
     $config['dbdriver'] = "mysql";
     $config['dbprefix'] = "";
     $config['pconnect'] = FALSE;
     $config['db_debug'] = TRUE;
     $config['cache_on'] = FALSE;
     $config['cachedir'] = "";
     $config['char_set'] = "utf8";
     $config['dbcollat'] = "utf8_general_ci";

     $this->load->database($config);
} else {
     $this->load->view('form_success');
}

Change all the variables to match your database information.

Taken from the userguide.




Theme © iAndrew 2016 - Forum software by © MyBB