[eluser]majidmx[/eluser]
great,
the way you're passing the data to your view is the problem.
change the controller to this one :
Code:
...
$data['query'] = $this->db->query('SELECT * FROM news')->results();
$this->load->view('index.php', $data);
...
And in your view :
Code:
...
<?php foreach($query as $row): ?>
...
Let me know if this worked or not.
Let's fix the problem first, then we can discuss the opportunities to improve your code
MajiD Fatemian