Welcome Guest, Not a member yet? Register   Sign In
Autoload Database not working
#1

[eluser]AntonioAntar[/eluser]
Hello friends.

I have been trying to connect my database (phpMyAdmin) to the website I'm working on

I'm trying to set up a login form. I'm having a problem retrieving data from the database (I'm trying to retrieve login credientals from a table).

So this is what I have as my set up for the database from my database.php file

Code:
$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost:1337',
'username' => 'root',
'password' => '',
'database' => 'test',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'autoinit' => TRUE,
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);

The database name i want to retrieve the data from is called test and my localhost is localhost:1337

Next step would be autoloading the database and this is where my problems start to happen. This is what I have as default in my autoload.php file

Code:
$autoload['libraries'] = array();
However, when I autoload the database like this

Code:
$autoload['libraries'] = array('database');
My localhost does not load anymore when I refresh it. I'm not getting an error, in fact I'm not getting anything at all, when I refresh it just shows me the page is refreshing and does that forever

When I remove 'database' from array i load the localhost and everything is working again

Now I tried to load the database in my model like this

Code:
$this->load->database();
the localhost refreshes and site works as normal, but my database is not loaded and my data is not retrieved.

Friends, any help would be greatly appreciated

Thank you very much

AntonioAntar


Messages In This Thread
Autoload Database not working - by El Forum - 07-14-2014, 11:39 AM
Autoload Database not working - by El Forum - 07-14-2014, 11:42 AM
Autoload Database not working - by El Forum - 07-14-2014, 12:11 PM
Autoload Database not working - by El Forum - 07-14-2014, 12:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB