title: codeigniter query array the return all rows be send using set_userdata()
body: <p>I am a newbie with codeigniter. I wrote this function but I can only get the last row in the array.  How do I get all the all the rolls so I can pass them to my view.<br>
  This is my method:</p>
  
  <pre><code>public function resources(){
  
   $this-&gt;load-&gt;library('session');
  
     $query = $this-&gt;db-&gt;query("SELECT * FROM recurso;");
  
     foreach ($query-&gt;result_array() as $row){
  
        $data= $row['example'];
      }
      $this-&gt;session-&gt;set_userdata($data);
      $this-&gt;load-&gt;view('recursos');
  }
  </code></pre>