Welcome Guest, Not a member yet? Register   Sign In
Loading database manually.
#1

[eluser]magiclko[/eluser]
Hello,

I'm trying to manually load the database library and trying to connect to some random database. Here is two line code

Code:
$dsn = $dbdriver.'://'.$username.':'.'$password'.'@'.'$hostname'.'/'.$databasename;
$this->load->database($dsn);

But when i var_dump($this->load->database($dsn)) , no matter i give correct credentials or not, i get NULL .Oh, i am not autoloading database. I don't see any problem due to this but just in case if its necesaary to mention it. Am i doing something wrong? One more thing, in $dsn, can i exclude $databasename ? I've tried both the syntax of specifying $dsn i.e.

Code:
$dsn = 'dbdriver://username:password@hostname/database';
and
Code:
$dsn = 'dbdriver://username:password@hostname/database?char_set=utf8&dbcollat=utf8_general_ci&cache_on=true&cachedir;=/path/to/cache';

but to no use, i always get a null . Actually i want to check connection to some database user is specifying. (both, with and without databasename preferrably!)




Theme © iAndrew 2016 - Forum software by © MyBB