These are chat archives for codeigniter-id/codeigniter-id.github.io

18th
Jan 2018
Samuele
@eleumas
Jan 18 15:46
Hi! Why the first value of array ($description) is insert two times in database? This is my code:
$data = array();
        for($i=0; $i<$count; $i++)
        {
          $data[$i] = array(
            'item_id'        => $item_id,
            'name_directory' => $directory,
            'description'    => $description[$i]
          );
          $this->admin_model->mdl_img_create('tbl_images', $data);
        }
Samuele
@eleumas
Jan 18 16:03
This is the var_dump of $description: array(2) { [0]=> string(2) "image description 1" [1]=> string(2) "image description 2" }
i use in my model insert_batch.
Samuele
@eleumas
Jan 18 16:25
solved. My problem was: $this->admin_model->mdl_img_create('tbl_images', $data); inside for statement.