There are two ways to connect to a database:
Automatically Connecting
The “auto connect” feature will load and instantiate the database class with every page load. To enable “auto connecting”, add the word database to the library array, as indicated in the following file:
application/config/autoload.php
Manually Connecting
If only some of your pages require database connectivity you can manually connect to your database by adding this line of code in any function where it is needed, or in your