Ver Mensaje Individual
  #8 (permalink)  
Antiguo 08/04/2011, 10:11
Avatar de Patriarka
Patriarka
 
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 2 meses
Puntos: 288
Respuesta: Imprimir Categoria y Subcategorias

algo asi funcionaria o le haria falta alguna mejora
solo necesitas una tabla
Código HTML:
Ver original
  1. [HIGHLIGHT="PHP"]
  2. function recursiva($padre=0){
  3.     $sql="select  from categories where id =".$padre;
  4.     $res=mysql_query($sql);
  5.     if(mysql_num_rows($res) > 0){
  6.         while ($row = mysql_fetch_object($res)) {
  7.             echo $row->category.'<br />';
  8.             if($row->category==0){
  9.                 recursiva($row->category);
  10.             }
  11.         }
  12.     }
  13. }
[/HIGHLIGHT]