title: Undefined Offset: 0 in Codeigniter
body: <p>When I sen a request this page , I got an error like this </p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Notice
  
  Message: Undefined offset: 0
  
  Filename: models/mproduk.php
  
  Line Number: 116
  </code></pre>
  
  <p>This is my controller</p>
  
  <pre><code>public function update($id=''){
          $data = array(); 
          $data['size'] = $this-&gt;msize-&gt;tampil();
  
          $data['eta']=$this-&gt;mproduk-&gt;berapakah_stoknya($id);
          $data['cats']   = $this-&gt;mkategori-&gt;tampil();
          $data['prd']    = $this-&gt;mproduk-&gt;get_produk_detail($id);
          $data['human']    = $this-&gt;mhuman-&gt;tampil();
  
          $html = array();
          $html['header']     = $this-&gt;load-&gt;view('secuser/header',null,true);
          $html['kiri']       = $this-&gt;load-&gt;view('secuser/kiri',null,true);
          $html['content']    = $this-&gt;load-&gt;view('secuser/product/update',$data,true);
          $this-&gt;load-&gt;view('secuser/template',$html);
      }
  </code></pre>
  
  <p>This is my model</p>
  
  <pre><code>public function berapakah_stoknya($kodepro){  
          $this-&gt;load-&gt;model('msize');
          $hahaha=$this-&gt;msize-&gt;tampil();
  
          foreach($hahaha as $wkwkwkw){
              $apa= $wkwkwkw['id'];
              $sql= "select  ukr_$apa from produk where kodeproduk = '".$kodepro. "'";
              $ggg= $this-&gt;db-&gt;query($sql)-&gt;result_array();    
              $return[]=array('stok'=&gt;$ggg[0]["ukr_$apa"],'ukuran'=&gt;$wkwkwkw['ukuran_produk'],'id_'=&gt;$apa);
          }
          return $return;
      }
  </code></pre>
  
  <p>If I use <strong>error_reporting(0)</strong> the page will be looping and show to be some page </p>
  
  <p>How can i fix this error?</p>