Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/08/2008, 10:46
rqd
 
Fecha de Ingreso: julio-2008
Mensajes: 228
Antigüedad: 16 años, 7 meses
Puntos: 8
Respuesta: mostrar datos de raiz

necesitas hacer una función recursiva
Código PHP:

function traeAfiliados(idAfiliado,nivel) {
    
$sql "SELECT * FROM afiliados wher padre = " $idAfiliado;
    
$nivel++;

     
$result=mysql_query($sql);
     if (
$nivel <= 4) {     
          while (
$row=mysql_fetch_array($result)) {
               
traeAfiliados($row['idAfiliado'],$nivel)
           }
     }