Welcome Guest, Not a member yet? Register   Sign In
Trouble connecting to Database
#1

[eluser]codeman[/eluser]
Hi guys,

an i doing right to access the database ?

Code:
$this->load->database();
echo "MYSQL is connected";

Code:
$active_group = "default";
$active_record = TRUE;

$db['default']['hostname'] = "hostmonster.com";
$db['default']['username'] = "blah";
$db['default']['password'] = "blah";
$db['default']['database'] = "blahaaa";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";


So i just configure my database file with right info and try to access the database but does not do anything no error or anything ...
#2

[eluser]Dam1an[/eluser]
If MySQL is on the same server as your web root, try setting host name ot localhost
#3

[eluser]codeman[/eluser]
No localhost does not work either,

when i run
Code:
$this->load->database();
echo "MYSQL is connected";

it stops running any other functions at this point,
#4

[eluser]Dam1an[/eluser]
try connecting directly to the database using plain old PHP (stick it in index.php so you know it'll definatly execute it
#5

[eluser]tomcode[/eluser]
Code:
$db['default']['hostname'] = "hostmonster.com";

is the MySQL server, not the web server. It's address is You communicated by Your hosting provider.




Theme © iAndrew 2016 - Forum software by © MyBB