CodeIgniter Forums
controller db - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: controller db (/thread-54730.html)



controller db - El Forum - 09-22-2012

[eluser]Captain_Fluffy_Pants[/eluser]
how do i include a the database from path "application/config" in a controller?
is it
this:
Code:
$this->db->config('database');
this:
Code:
$this->include('database');
this:
Code:
$this->load->config('database');
this:
Code:
$this->load->database('group_name');
or this:
Code:
$this->config('database');




controller db - El Forum - 09-22-2012

[eluser]TWP Marketing[/eluser]
In the User Guide:

http://ellislab.com/codeigniter/user-guide/database/examples.html

load the database class in your controller (or base controller) It only needs to be done once:

Code:
$this->load->database();

In the file application/config/database.php

Set your database configuration settings:
You will need the correct database name, username and user password
You will also need to know which database type your are using. See the settings in the UG.