How to insert multiple array data using codeigniter active record

Below is the example to insert multiple array data using query builder class of codeigniter. By using $this->db->insert_batch() method we can achieve this.

defined(‘BASEPATH’) OR exit(‘No direct script access allowed’);
class InsertController extends CI_Controller {
public function __construct()
    public function index() {
        $data[] = array(
$data[] = array(
$this->db->insert_batch( ‘tbl_user’, $data );

Thank you for reading this post. we hope you like this Post, Please feel free to comment below, your suggestion and problems if you face – let us know. We’d love to help!

Author: Hitesh

I am Hitesh from Jamshedpur (India). I have been working as a Web Application Developer from last 4+ years. I love diverse and attention catching web presence for a variety of users. Also I love to learn new things in Web Development.