How to create database connection using CodeIgniter?

This post explains about How to create database connection using Codegniter. Follow the below steps
1. Create new/existing user for your application
2. Create new/existing database for your application
3. Get those details and update in below file
4. Run the application

How to create database connection using CodeIgniter by Anil Kumar Panigrahi

How to create database connection using CodeIgniter by Anil Kumar Panigrahi

in the file at : application\config\database.php.

we have to configured the database connection.

$db['default']['hostname'] = ""; // Host Name
$db['default']['username'] = ""; // User Name
$db['default']['password'] = ""; // Password
$db['default']['database'] = ""; // Database Name
$db['default']['dbdriver'] = ""; // Databse driver.


when we configured we can connect to the database.

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online

Contact : [email protected]

You may also like...

2 Responses

  1. August 6, 2009

    […] How to create database connection using codegniter? « ANIL KUMAR […]

  2. March 9, 2015

    […] In earlier we have learned few topics regarding CodeIgniter i.e. Pagination, Upload images and Database connection. Now we will learn how to remove index.php from URLs. Removing index.php from URLs in CodeIgniter […]

Leave a Reply

Your email address will not be published. Required fields are marked *