[Solved] Only getting the first character of the array element


From your array the foreach loop should look like this

$toilet_arr = array ( 0 => 'Water Sealed', 1 => 'Open Pit', 2 => 'None' );

if (count($toilet_arr)) {
   foreach($toilet_arr as $row) {
      $data = array("hof_id"=>$last_id,"toilet_type"=>$row);
      $this->db->insert('toilet_tbl',$data);
    }
}

This should insert values as they are if the problem still persists check the length in your database for column toilet_type. You need to set varchar(250) for column toilet_type

4

solved Only getting the first character of the array element