Welcome Guest, Not a member yet? Register   Sign In
Autoloading the Database problem
#1

[eluser]bastiat[/eluser]
Hey there. First time to Codeigniter this week.

Found out about it through Nettuts. Pretty cool! Really!!

So anyway, I set up my database in database.php and added it to the 'libraries' parameter
in autoload.

The thing is, every time it's in autoload, I can't get the welcome page, and I get a face
full of error.

Can I get some help troubleshooting this please?
I can't suss this out through the documentation.

Code:
?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------
------------------------------------------------------- | DATABASE CONNECTIVITY SETTINGS |
------------------------------------------------------------------- | This file will
contain the settings needed to access your database. | | For complete instructions please
consult the 'Database Connection' | page of the User Guide. | | ---------------------------
---------------------------------------- | EXPLANATION OF VARIABLES | ---------------------
---------------------------------------------- | |    ['hostname'] The hostname of your
database server. |    ['username'] The username used to connect to the database |    
['password'] The password used to connect to the database |    ['database'] The name of the
database you want to connect to |    ['dbdriver'] The database type. ie: mysql. Currently
supported: mysql, mysqli, postgre, odbc, mssql, sqlite, oci8 |    ['dbprefix'] You can add
an optional prefix, which will be added |     to the table name when using the Active
Record class |    ['pconnect'] TRUE/FALSE - Whether to use a persistent connection |    
['db_debug'] TRUE/FALSE - Whether database errors should be displayed. | ['cache_on']
TRUE/FALSE - Enables/disables query caching |    ['cachedir'] The path to the folder where
cache files should be stored |    ['char_set'] The character set used in communicating with
the database |    ['dbcollat'] The character collation used in communicating with the
database |    ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|    ['autoinit'] Whether or not to automatically initialize the database. |    
['stricton'] TRUE/FALSE - forces 'Strict Mode' connections |     - good for ensuring strict
SQL while developing | | The $active_group variable lets you choose which connection group
to | make active. By default there is only one group (the 'default' group). | | The
$active_record variables lets you determine whether or not to load | the active record
class */ $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] =
'xxxx'; $db['default']['username'] = 'xxxx'; $db['default']['password'] = 'xxxxxxx';
$db['default']['database'] = 'xxxxxxx'; $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; /* End of file database.php */ /* Location:
./application/config/database.php */

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at
/var/www/nettuts/application/config/database.php:9)

Filename: core/Common.php

Line Number: 409

An Error Was Encountered
No database connection settings were found in the database config file.
#2

[eluser]WanWizard[/eluser]
You might want to replace "?php" by "<?php" on the first line...
#3

[eluser]bastiat[/eluser]
OMG! Duh! Tongue

I didn't even see that.
I guess my inexperience with PHP had me looking for something more dramatic. Tongue
Don't know how that happened. I was using everything straight out of the package.

Thanks WW. That fixed it.

Sometimes I don't know what my third hand is doing.




Theme © iAndrew 2016 - Forum software by © MyBB