title: Codeigniter result array return only one row
body: <p>Am trying to encode an array to json for use with jquery.
  This is the function from my model</p>
  
  <pre><code>function get_latest_pheeds() {
          $this-&gt;load-&gt;helper('date');
           $time = time();
           $q = $this-&gt;db-&gt;select("user_id,pheed_id,pheed,datetime,COUNT(pheed_comments.comment_id) as comments")
                          -&gt;from('pheeds')
                          -&gt;join('pheed_comments','pheed_comments.P_id=pheeds.pheed_id','left')
                          -&gt;group_by('pheed_id')
                          -&gt;order_by('datetime','desc')
                          -&gt;limit(30);
          $rows = $q-&gt;get();
              foreach($rows-&gt;result_array() as $row) {
                  $data['user_id'] = $row['user_id'];
                  $data['pheed_id'] = $row['pheed_id'];
                  $data['pheed'] = $row['pheed'];
                  $data['comments'] = $row['comments'];
                  $data['datetime'] = timespan($row['datetime'],$time);
              }
              return $data;
       }
  </code></pre>
  
  <p>And this is from my controller </p>
  
  <pre><code>function latest_pheeds() {
              if($this-&gt;isLogged() == true) {
              $this-&gt;load-&gt;model('pheed_model');
              $data = $this-&gt;pheed_model-&gt;get_latest_pheeds();
  
                  echo json_encode($data);
  
              return false;
          }
      }
  </code></pre>
  
  <p>It returns only 1 row from the database when I run the code in the browser.
  Please help me out</p>