Welcome Guest, Not a member yet? Register   Sign In
MySQL Connection / PHP complaints
#1

[eluser]danfloun[/eluser]
Hi,
I've just installed the latest xampp and have installed Code Igniter which so far is looking good. I've run through the tutorials to get to grips with the basics but I've hit a minor problem

Although I seem to have no connection failures I get an error at the top of my index.php when trying to access the MySQL database.

The error:

Code:
A PHP Error was encountered

Severity: Notice

Message: Use of undefined constant database - assumed 'database'

Filename: config/autoload.php

Line Number: 41

My test server:

Apache: 2.2.4
PHP: 5.2.3
MySQL: 5.0.45


My autoload.php

Code:
$autoload['libraries'] = array(database);

My database.php

Code:
$active_group = "default";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "mypassword";
$db['default']['database'] = "blog";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";

Thanks for any help
#2

[eluser]Phil Sturgeon[/eluser]
This a PHP syntax warning. You are not making database a string, instead its a constant which it assumes to be a string.

Use:

Code:
$autoload['libraries'] = array('database');
#3

[eluser]danfloun[/eluser]
DOH!

That sorted it, thanks for pointing out the obvious.
It has been a long night lol..

Thanks again.




Theme © iAndrew 2016 - Forum software by © MyBB