Can anyone tell me I get the error: Fatal error: Call to a member function fetch_assoc() on a non-object for this method inside the class
This is a recursive function, and it runs fine the first time, is the second time when I get the error.
function getSite($var, $var1 = 0, $numLevel = 1){
//get the page
$qry = "SELECT * FROM table WHERE columnA = $var AND columnB = $var1 ORDER BY parent, position ASC";
$arrPage = $this->my_sqli->query($qry);
//a valid resut was returned from the DB
while($obj = $arrPage->fetch_assoc()){
//add to array
if($obj['id']){
$this->arrMenu = array(
'id' => $obj['id'],
'parent' => $obj['parent'],
'level' => $numLevel
);
... some more code
// call the function again
getSite($value1);
}
}
}