CodeIgniter Forums

Full Version: [SOLVED] Database Error!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Emkay[/eluser]
Hi guys,

I am a bit of a novice PHP programmer and it's my first time using a PHP framework. As far as I'm finding it very helpful and convenient, I can't seem to get past a very simple hurdle. No matter how I configure my database settings I keep getting the same error:

Quote:Your application/config/database.php file does not appear to contain a valid configuration array.

My configuration settings are as follows

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

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'test';
$db['default']['database'] = 'test';
$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';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Can anyone pinpoint at the problem? I am certain the database access credentials are correct.

El Forum

[eluser]Emkay[/eluser]
Anyone? Please help, this is driving me insane! All other scripts are working with the same credentials, have I missed out something in the other parts of the codeigniter configuration?

El Forum

[eluser]InsiteFX[/eluser]
Your credentials should be what you setup MySQL for on your system!

Also make sure that you start MySQL or it will never work!

Also try truning off pconnect = FALSE

The Error is stating that the config file is wrong!

Check for white space before and after

InsiteFX

El Forum

[eluser]danmontgomery[/eluser]
Are you trying to manually load the database config? That error message is only called by $this->config->load()...?

El Forum

[eluser]Emkay[/eluser]
Nevermind. Being a noob I added the database entry in the wrong autoload configuration, I put it in the config array instead of the library array! Now I no longer get the error message! Big Grin