How can you run mysqli query with CodeIgniter mysqli?

How can you run mysqli query with CodeIgniter mysqli?

In this post we will show you run mysqli query with CodeIgniter mysqli, hear for run mysqli query with CodeIgniter mysqli we will give you demo and example for implement.

how to set CodeIgniter mysqli
how to set CodeIgniter mysqli

setp for CodeIgniter mysqli in your project

Step 1 : go to database.php and change dbdriver

/application/config/database.php

	
//change:
$db['default']['dbdriver'] = 'mysql';   
//with:
$db['default']['dbdriver'] = 'mysqli';

You should change the content of the file DB_driver.php in you codeigniter system directory.

Step 2 : go to DB_driver.php and change $dbdriver

Go to:
system/database/DB_driver.php
And change the following line:

	
var $dbdriver = 'mysql'; 
// to :
var $dbdriver = 'mysqli'; 

here is a extraction of the DB_driver.php

	
 * MySQLi Database Adapter Class - MySQLi only works with PHP 5
 *
 * Note: _DB is an extender class that the app controller
 * creates dynamically based on whether the active record
 * class is being used or not.
 *
 * @package        CodeIgniter
 * @subpackage    Drivers
 * @category    Database
 * @author        ExpressionEngine Dev Team
 * @link        
 */
class CI_DB_mysqli_driver extends CI_DB {

    var $dbdriver = 'mysqli'; 

Hope this code and post will helped you for implement run mysqli query with CodeIgniter mysqli. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org

Leave a Comment

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

  +  47  =  50

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US