title: Error trying to show data from db on table
body: <p>I was working this side project trying to learn CI, but currently got some errors that i haven't found the answer to. I already tried some suggestions/answer like <code>die($this-&gt;db-&gt;last_query());</code> and <code>var_dump</code>
  but it still shown the error. 
  The data is shown on my view using <code>&lt;?php echo print($list_rawmat) ?&gt;</code>
  but it wont show up in the table (same page)
  Here's the view </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?php echo print($list_rawmat) ?&gt;
  &lt;div id="list_data_rawmat"&gt;
    &lt;table class="table table-hover text-centered"&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;b&gt;No.&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Jenis Barang&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Nama Barang&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Harga Satuan&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Jumlah&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Satuan&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Berat&lt;/td&gt;
              &lt;td&gt;&lt;b&gt;Edit/Delete&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php
  
          $i = 1;
               foreach($list_rawmat as $row)
              {
                  $type = "Raw Material";
                  echo "&lt;tr&gt; 
                  &lt;td&gt;".$i++."&lt;/td&gt;
                  &lt;td&gt;".$type."&lt;/td&gt;
                  &lt;td&gt;".$row-&gt;rawmat_name."&lt;/td&gt;
                  &lt;td&gt;".$row-&gt;rawmat_price."&lt;/td&gt;
                  &lt;td&gt;".$row-&gt;qty."&lt;/td&gt;
                  &lt;td&gt;".$row-&gt;qty_nama."&lt;/td&gt;
                  &lt;td&gt;".$row-&gt;weight."&lt;/td&gt;
      &lt;/tr&gt;"; 
              }
              ?&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here's the model </p>
  
  <pre class="lang-php prettyprint-override"><code>    *$proyek = AM1 (it was sent by previous page)
  function list_rawmat($proyek){
          $sql = "SELECT * FROM order_table g, order_detail b 
              WHERE g.project_id = '".$proyek."' AND g.order_detail_id = b.order_detail_id";
      $item_id = $this-&gt;db-&gt;query($sql)-&gt;result();
      $i = 0;
      $result = array();
      foreach($item_id as $row){
          if ($row-&gt;rawmat_id != null) {
              $sql2 = "SELECT g.order_id, g.order_date, g.total, b.qty, i.rawmat_id, i.rawmat_name, i.rawmat_price, b.weight, h.qty_nama
          FROM order_table g, order_detail b, raw_material i, quantity_type h
          WHERE g.project_id = '".$proyek."' AND b.rawmat_id = i.rawmat_id 
          AND h.qty_type_id = b.qty_type_id AND g.order_detail_id = b.order_detail_id ";
              $query = $this-&gt;db-&gt;query($sql2);
              $result[$i++] = $query-&gt;result();
          }
      }
      return $result;
  }
  </code></pre>
  
  <p>and lastly here's the controller </p>
  
  
  
  <pre class="lang-php prettyprint-override"><code>*$this-&gt;session-&gt;project_id = AM1 (sent from view before the view in question)
  function view_data_rawmat(){
      $config['base_url'] = base_url().'index.php/c_data/index';
      $config['total_rows'] = $this-&gt;m_data-&gt;count();
      $config['per_page'] = 10;
      $config['next_link'] = 'Selanjutnya';
      $config['prev_link'] = 'Sebelumnya';
      $config['uri_segment'] = 3;
      $this-&gt;pagination-&gt;initialize($config); 
      $offset=$this-&gt;uri-&gt;segment(3);     
      $data['list_rawmat'] = $this-&gt;m_data-&gt;list_rawmat($this-&gt;session-&gt;project_id);
      $str_links = $this-&gt;pagination-&gt;create_links();
      $data["links"] = explode('&amp;nbsp;',$str_links );
      $this-&gt;load-&gt;view ('view_header');
      $this-&gt;load-&gt;view ('view_data_rawmat',$data);
      $this-&gt;load-&gt;view ('view_footer');
      //die($this-&gt;db-&gt;last_query());
  }
  </code></pre>
  
  <p>This is the result from <code>echo print_r ($list_rawmat);</code></p>
  
  <pre class="lang-php prettyprint-override"><code>Array ( [0] =&gt; Array ( 
  [0] =&gt; stdClass Object ( [order_id] =&gt; 5 [order_date] =&gt; 2016-04-05 [total] =&gt; 876348553 [qty] =&gt; 313 [rawmat_id] =&gt; 1 [rawmat_name] =&gt; WF - 346x174x6x9 L.9000mm [rawmat_price] =&gt; 7514 [weight] =&gt; 116624 [qty_nama] =&gt; Bh ) 
  [1] =&gt; stdClass Object ( [order_id] =&gt; 6 [order_date] =&gt; 2016-11-10 [total] =&gt; 2147483647 [qty] =&gt; 10 [rawmat_id] =&gt; 2 [rawmat_name] =&gt; WF - 336x174x6x9 L.9000mm [rawmat_price] =&gt; 1848000 [weight] =&gt; 116624 [qty_nama] =&gt; Sets ) ) 
  [1] =&gt; Array ( 
  [0] =&gt; stdClass Object ( [order_id] =&gt; 5 [order_date] =&gt; 2016-04-05 [total] =&gt; 876348553 [qty] =&gt; 313 [rawmat_id] =&gt; 1 [rawmat_name] =&gt; WF - 346x174x6x9 L.9000mm [rawmat_price] =&gt; 7514 [weight] =&gt; 116624 [qty_nama] =&gt; Bh ) 
  [1] =&gt; stdClass Object ( [order_id] =&gt; 6 [order_date] =&gt; 2016-11-10 [total] =&gt; 2147483647 [qty] =&gt; 10 [rawmat_id] =&gt; 2 [rawmat_name] =&gt; WF - 336x174x6x9 L.9000mm [rawmat_price] =&gt; 1848000 [weight] =&gt; 116624 [qty_nama] =&gt; Sets ) ) ) 1
  </code></pre>
  
  <p>I don't know why the array is like that, please enlighten me about this too.</p>