Pages

Saturday, June 30, 2018

How to Check Version of Codeigniter Framework Using

Method 1:
Follow this path : root_folder of CI
Navigate to system -> Core -> Codeigniter.php
Here you can see the version of CI under CI_VERSION constant.
define('CI_VERSION', '3.0.0');

Method 2:
Easy and simple way:
Just write below line in any controller or any view

for example Welcome.php or Index.php (Controller)
In any function or constructor put this:

echo CI_VERSION;

This will give you the version of the CI currently you are using.

Codeigniter | How to Insert Batch Records

When you want to insert batch data into database table then you not need to insert using loop just use insert_batch function provided by Codeigniter.
Example :

$data = array(
   array(
      'title' => 'Title 1' ,
      'name' => 'Name 1' ,
      'date' => 'date('Y-m-d H:i:s)'
   ),
   array(
      'title' => 'Title 2' ,
      'name' => 'Name 2' ,
      'date' => 'date('Y-m-d H:i:s)'
   )
);

$this->db->insert_batch('your_table_name', $data);

This will reduce memory and execution time.