title: foreach not working in codeigniter
body: <p>I am currently new to database query and other for codeigniter can not seem to quite get model working for what I am after.</p>
  
  <p>I have tried loading db in direct to controller and that works OK. But if I call my model does not want to work nothing shows up.</p>
  
  <p>Here is what I would like to achieve.  </p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function website_test_model() {
  
      $this-&gt;load-&gt;model('admin/website/model_website');
  
      $results = $this-&gt;model_website-&gt;getWebsites();
  
      $data['websites'] = array();
  
          foreach ($results as $result) {
              $data['websites'] = array(
                  'website_id' =&gt; $result['website_id'],
                  'name' =&gt; $result['name'],
                  'url' =&gt; $result['url']
              );
          }
  
      $this-&gt;load-&gt;view('website/websites', $data);
     }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>&lt;!-- Not Working From Controller Function Model Test --&gt;
  
  &lt;?php if ($websites) { ?&gt;
  &lt;?php foreach ($websites as $website) { ?&gt;
  
  &lt;?php echo $website['website_id'];?&gt;
  
  &lt;br&gt;
  
  &lt;?php echo $website['name'];?&gt;
  
  &lt;br&gt;
  
  &lt;?php echo $website['url'];?&gt;
  
  &lt;?php } ?&gt;
  &lt;?php } ?&gt;
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>&lt;?php
  
  class Model_website extends CI_Model {
  
    function getWebsites() {
          $this-&gt;db-&gt;select('*');
          $this-&gt;db-&gt;from('website');
        $this-&gt;db-&gt;where('website_id');
        $this-&gt;db-&gt;where('name');
        $this-&gt;db-&gt;where('url');
        $query = $this-&gt;db-&gt;get();
  
        if($query-&gt;num_rows() &gt; 0) {
          return $query-&gt;row();
        } else {
          return false;
        }
    }
  
  
  }
  </code></pre>
  
  <p>Codeigniter Demo It works when I try it this way as said on codeigniter User Guide. Just the code above is way I am after though Trying to make model work no luck</p>
  
  <pre><code>public function website() {
  
      $results = $this-&gt;db-&gt;get('website'); // Works Direct From Controller OK.
  
          foreach ($results-&gt;result() as $row) {
              $data = array(
                  'website_id' =&gt; $row-&gt;website_id,
                  'name' =&gt; $row-&gt;name,
                  'url' =&gt; $row-&gt;url
              );
          }
  
      $this-&gt;load-&gt;view('website/website', $data);
     }
  </code></pre>