title: How to display in my view if 2 or more rows are returned but in my view I want to display single column where primary key(npp) same
body: <p>I'm confused how
  I want  to display like this (just click in link)
  there's view and database<br>
  <a href="https://www.dropbox.com/s/bb7k4ck7l2prrzh/boom.JPG?dl=0" rel="nofollow">this my view which I want</a></p>
  
  <p>Explanation:
  If in database I insert in table</p>
  
  <pre><code>npp:87  
  tgl_masuk:20/02/2009    
  nama:ulung  tgl_mulai:01/01/2015
  tgl_pengajuan:03/01/2015    
  tgl_selesai:08/01/2015  
  lama:5  
  bagian:1
  </code></pre>
  
  <p>this data will display on column bagian=1 and the field value=5
  etc</p>
  
  <p>this my view now</p>
  
  <pre><code>&lt;thead&gt;
  &lt;tr&gt;
  
  &lt;th&gt;npp&lt;/th&gt;
  &lt;th&gt;Nama &lt;/th&gt;
  &lt;th&gt;Tanggal Masuk &lt;/th&gt;
  &lt;th&gt;Tanggal Mulai&lt;/th&gt;
  &lt;th&gt;Tanggal Selesai&lt;/th&gt;
  &lt;th&gt;Lama&lt;/th&gt;
  &lt;th&gt;Bagian&lt;/th&gt;
  &lt;th&gt;tanggal Pengajuan&lt;/th&gt;
  
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  &lt;?php  if(!empty($query)) { foreach($query as $row) { ?&gt; 
  &lt;tr&gt;
  
  &lt;td style="text-align:center;font-weight:bold"&gt;
  &lt;span class="label label-warning"&gt;&lt;?php echo $row-&gt;npp ?&gt;&lt;/span&gt;
  &lt;/td&gt;
  &lt;td&gt;&lt;?php echo $row-&gt;nama_pegawai ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php echo $row-&gt;tgl_masuk ?&gt;&lt;/td&gt;
  
  &lt;td&gt;&lt;?php echo $row-&gt;tgl_mulai ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php echo $row-&gt;tgl_selesai ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php echo $row-&gt;lama ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php echo $row-&gt;bagian ?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php echo $row-&gt;tgl_pengajuan ?&gt;&lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;?php }} ?&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>function index($limit='',$offset=''){
      if($this-&gt;session-&gt;userdata('LOGIN')=='TRUE'){
      $this-&gt;load-&gt;model("Cutitahun_Model"); 
      $data['judul']='Histori Cuti tahun Pegawai';
      /* VAGINATION */
      if($limit==''){ $limit = 0; $offset=10 ;}
      if($limit!=''){ $limit = $limit ; $offset=$this-&gt;offset ;}
      $data['count']=$this-&gt;Cutitahun_Model-&gt;countcuti_tahun();   
      $config['base_url'] = base_url().'Cuti_tahun/search/';
      $config['total_rows'] = $data['count'];
      $config['per_page'] = $this-&gt;limit;    
      $config['cur_tag_open'] = '&lt;span class="pg"&gt;';
      $config['cur_tag_close'] = '&lt;/span&gt;';       
      $this-&gt;pagination-&gt;initialize($config);
      /*----------------*/
      $data['query']=$this-&gt;Cutitahun_Model-&gt;getListCuti($limit,$offset);
      $data['view']='Cuti_tahun/hist_cuti';
      $this-&gt;load-&gt;view('index',$data);
      }else {
      redirect('home/loginPage');     
      }
  
   }
  </code></pre>
  
  <p>model</p>
  
  <pre><code>function getListCuti($limit='',$offset=''){
          $menus='';
          $judul=$this-&gt;input-&gt;post('judul');
          $status=$this-&gt;session-&gt;userdata('STATUS');
          $addTag="";
          if($status!=0){
          $addTag="where t_pegawai.nik='".$this-&gt;session-&gt;userdata('NIK')."'";    
          }
          $query=$this-&gt;db-&gt;query("select t_cuti.status as status,t_cuti.id as cutiid,t_pegawai.id,t_pegawai.nik,t_pegawai.nama,m_jabatan.nama_jabatan,m_unit_kerja.nama_unit_kerja,m_cabang.nama_cabang from t_cuti
          LEFT JOIN t_pegawai ON t_pegawai.nik=t_cuti.nik
          LEFT JOIN m_jabatan ON t_pegawai.kd_jabatan=m_jabatan.kd_jabatan
          LEFT JOIN m_unit_kerja ON t_pegawai.kd_unit_kerja=m_unit_kerja.kd_unit_kerja
          LEFT JOIN m_cabang ON t_pegawai.kd_cabang=m_cabang.kd_cabang
          $addTag
          ORDER BY t_cuti.id DESC LIMIT $limit,$offset");
           if ($query-&gt;num_rows() &gt; 0) {
              foreach ($query-&gt;result() as $data) {
                  $menus[]=$data;
              }
              return $menus;
          }
  
      }
  </code></pre>