[eluser]TheFuzzy0ne[/eluser]
Ideally, your method should always return something other than void, like FALSE. Then you can test that you've actually got a result returned. If you add a die statement to the end of that method, I you may find it triggers sometimes. A more fluid code layout might look something like this:
Code:
function get_breadcrumb($id=NULL)
{
$id = (int)$id;
$breadcrumb = array();
$res = $this->db->get_where('categories', array('id' => $id));
if ($res->num_rows() > 0)
{
$row = $res->row_array();
if ($row['parentid'])
{
$breadcrumb = array_merge($breadcrumb, $this->get_breadcrumb($row['parentid']));
}
}
return $breadcrumb;
}
It's untested, but I think it might work.