I have created a function(recursive). It will call again if it has parent id otherwise it will return last Id. The Problem is I'm unable to return the last Id which passed in the Function argument. It is showing complete if I use var_dump() or echo but unable to return in return().
Here is Sample Code :
function abc($dbcon,$id){
$get_quy = "select * from member_mst where member_status=0 and pid=".$id;
$get_rs = $dbcon->query($get_quy);
$get_numrows = mysqli_num_rows($get_rs);
$get_rel = mysqli_fetch_assoc($get_rs);
if($get_numrows>0){
abc($dbcon,$get_rel['member_id']);
}else{
//var_dump($id);//This will return => "String '3'"
return $id;
}
}
var_dump(abc($dbcon,1));//Returning Null