A PHP Error was encountered

Severity: Warning

Message: preg_match(): Compilation failed: unmatched closing parenthesis at offset 38

Filename: hooks/Check_user.php

Line Number: 217

Backtrace:

File: /home/b2z283hyjn3q/public_html/application/hooks/Check_user.php
Line: 217
Function: preg_match

File: /home/b2z283hyjn3q/public_html/application/hooks/Check_user.php
Line: 84
Function: getOS

File: /home/b2z283hyjn3q/public_html/application/hooks/Check_user.php
Line: 10
Function: anylisis

File: /home/b2z283hyjn3q/public_html/index.php
Line: 315
Function: require_once

Unknown Database Configuration in Codeigniter |Codeigniter tutorial for beginners step by step in hindi | My Project HD
X

Database Configuration in Codeigniter |Codeigniter tutorial for beginners step by step in hindi

Database Configuration in Codeigniter |Codeigniter tutorial for beginners step by step in hindi





in this tutorial we will Discuss about how to configure database in codeigniter . for configure database in codeigniter you can open config/database.php file 
in config/database.php file you can set follwing values 

What Is Database :

Database is library in codeigniter . database library used in codeigniter for communicate with database.this library provide you many features to communicate with database

 

 

'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'mypro_ci_tutorial',

 

$db['default'] = array(
    'dsn'    => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'mypro_ci_tutorial',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

 

How To Load Database 

There are the following ways to load the database in codeigniter

1. autoload.php 

in codeigniter you can load database library in autoload.php file. in autoload.php file you can load database library in library array .this library accessible in complete codeigniter project


$autoload['libraries'] = array('database');

 

2. Current Controller Constructor :

you can load database library . in current controller constructor using following code .this library accessible only current controller

punlic function __construct()
{
  parent::__construct();
  $this->load->library('database');
}

 


Related Tutorials