Intento obtener un dato pero creo que nunca lo obtendré puesto que el ciclo de la recursividad lo uso mal.
Código PHP:
function getNivelCero($uni_id){
$sql = "select uni_parentid,uni_id from tab_unidad where uni_id = ".$uni_id;
$result = pg_query($this->connect(), $sql);
$row = pg_fetch_assoc($result);
if($row['uni_parentid'] != 0){
$this->getNivelCero($row['uni_parentid']);
} else {
return $row['uni_id'];
}
return $uni_id;
}
Una colaboración por favor.