[eluser]Edemilson Lima[/eluser]
You must set a variable with your result and them pass it to your view:
Code:
$data['results']=$query->result();
$this->load->view('myview',$data);
Then you must place the foreach() into your view file, using the alternative PHP syntax:
Code:
<table>
<?php foreach($results as $row): ?>
<tr>
<td><?=$row['field1']?></td>
<td><?=$row['field2']?></td>
</tr>
<?php endforeach; ?>
</table>
By this way, you also keep your presentation logic separated from your controller.