Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to configure database in Codeigniter

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 100
    Comment on it

    Hello Readers,

    In order to create any web application using Codeigniter framework or any other PHP framework we need to configure database .

    We have the database file inside application folder of a Codeigniter framework , inside application folder their is a config folder and inside config folder you will find database.php.

    application->config->database.php
    

    Database.php looks like this.

    $db['default']['hostname'] = 'hostname';
    $db['default']['username'] = 'username';
    $db['default']['password'] = 'password';
    $db['default']['database'] = 'database name';
    $db['default']['dbdriver'] = 'mysql';
    $db['default']['dbprefix'] = 'ps_';
    $db['default']['pconnect'] = TRUE;
    $db['default']['db_debug'] = FALSE;
    $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;
    

    you can simply change the host , username , password and database name according to your need.

    Enjoy coding.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: