title: how to insert array data in single column in mysql using codeigniter
body: <p>I'm trying to insert array data into database using codeigniter. when I print that values using <code>print_r()</code> fun. </p>
  
  <p>It shows correct result, but when I click on save button it inserts blank values in table.</p>
  
  <p>I just want to store multiple medicine names in prescription table for particular prescription_id i am trying to insert data using insert_batch function but it saves blank records</p>
  
  <p>this is my model code:</p>
  
  <pre><code>public function add_prescription($data) {
  
      $data['medicine_name'] = $data['medicine_nm[]'];
      print_r($data['medicine_name']);
  
      $this-&gt;db-&gt;insert_batch('pre',$data);
       return $this-&gt;db-&gt;insert_id($pre_id);
    }
  </code></pre>
  
  <p>controller code--</p>
  
  <pre><code>public function prescription($patient_id = NULL, $app_date = NULL, $hour = NULL , $min = NULL) {
  
      //Check if user has logged in 
      if (!$this-&gt;session-&gt;userdata('user_name') || $this-&gt;session-&gt;userdata('user_name') == '') {
          redirect('login/index/');
  
      } else {
  
          if ($this-&gt;form_validation-&gt;run() === FALSE) {
            $data['medicine_nm[]']=$this-&gt;input-&gt;post('medicine_nm[]');   
             $this-&gt;patient_model-&gt;add_prescription($data);
          }
      }
  }
  </code></pre>