title: A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach()
body: <p>im new in codeigniter</p>
  
  <pre><code>A PHP Error was encountered
  Severity: Warning
  Message: Invalid argument supplied for foreach()  
  Filename: views/siswa_spp.php
  Line Number: 39
  </code></pre>
  
  <p>and i cant solve that error, here is my controller :</p>
  
  <pre><code>function siswa($id_siswa)
    {
        $data['spp']            = $this-&gt;M_spp-&gt;detail_spp($id_siswa)-&gt;row();
        $data['temp']           = $this-&gt;M_spp-&gt;temp_spp($id_siswa)-&gt;row();
        $data['list']           = $this-&gt;M_spp-&gt;list_temp($id_siswa)-&gt;result();
        $data['bulan']          = $this-&gt;M_spp-&gt;listbulan($id_siswa);
  
        $this-&gt;load-&gt;view('includes/head');
        $this-&gt;load-&gt;view('includes/nav_header');
        $this-&gt;load-&gt;view('includes/nav_sidebar');
        $this-&gt;load-&gt;view('siswa_spp',$data);
        $this-&gt;load-&gt;view('includes/foot');
    }
  </code></pre>
  
  <p>my model :</p>
  
  <pre><code>function listbulan($id_siswa)
    {
      $this-&gt;db-&gt;select('*');
      $this-&gt;db-&gt;from('tb_spp');
      $this-&gt;db-&gt;where('id_siswa',$id_siswa);
  
      $query = $this-&gt;db-&gt;get();
  
      if ($query-&gt;num_rows() &gt; 0) {
        $result = $query-&gt;result();
      }
  
      return $result;
    }
  </code></pre>
  
  <p>and my view : </p>
  
  <pre><code>&lt;?php
     foreach ($bulan as $b) {
      echo $b-&gt;bulanPembayaran;
     }
  ?&gt;
  </code></pre>
  
  <p>i dont know where the error in my code, and sorry for bad english</p>