[eluser]n1colius[/eluser]
I just begin my first project with CI, and i have a problem when i want to call a function within a class.
this is the my model class have code like this
Code:
<?php
class Model_admin_page extends Model {
function Model_admin_page()
{
// Call the Model constructor
parent::Model();
}
function getKategoriPage($parent,$level)
{
$sql = "SELECT catID,nama,parent FROM category_page WHERE catID<>'0' AND parent=? ORDER BY catID";
$var_sql = array($parent);
$query = $this->db->query($sql,$var_sql);
$data = array();
foreach ($query->result_array() as $q_data)
{
$q_data['level'] = $level;
$data = $q_data;
$b = $this->getKategoriPage($q_data['catID'],$level+1); //error in this line
for($j=0;$j<count($b);$j++)
{
$data[] = $b[$j];
}
}
return $data;
}
}
?>
The problem is when i when to call a function within a same class, it gives me error
Message: Undefined offset: 0
any solution?