Fetch records between date range using Codeigniter active record

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.

[php]
<?php
defined(‘BASEPATH’) OR exit(‘No direct script access allowed’);
class InsertController extends CI_Controller {
public function __construct()
{
parent::__construct();
}
    public function index() {
        $data[] = array(
‘name’=>’Avinash’,
‘mobile’=>’72345613’,
‘address’=>’Delhi’
);
$data[] = array(
‘name’=>’Dinesh’,
‘mobile’=>’78945676’,
‘address’=>’Mumbai’
);
$this->db->insert_batch( ‘tbl_user’, $data );
    }
}
[/php]

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!