[eluser]jedd[/eluser]
Instead of this:
Quote:Code:
$query = $this->db->query('SELECT menu FROM menu');
foreach ($query->result() as $row) {
$data['menu']= $row;
}
... do this:
Code:
$query = $this->db->query ('SELECT menu FROM menu');
if ($query->num_rows() != 0)
$data['menu'] = $query->result_array();
You might want to wrap other stuff into that logic - such as setting another variable to notify your menu view code that it's empty, or just handle an empty array in the view - or bomb out in the controller with a die() or similar, assuming that an empty menu at this point signifies an error with aborting on (it does imply something horrible has happened to your database connectivity, I think).
Depending how your view menu works - if it's a table of URL's say? - you might want to select * from menu instead, so you can do links to menu #'s rather than just menu names. But as I say, this depends on how you've set up your menu links.