Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/07/2012, 11:10
charlyta
 
Fecha de Ingreso: junio-2008
Mensajes: 291
Antigüedad: 15 años, 10 meses
Puntos: 9
error al crear categoria subcategoria

Hola a todos. Al llamar la siguiente función, me aparece un error que no sé cómo solucionar. Alguna sugerencia?

Código PHP:
function menuList($data$parent )
{
static 
$i 1;
$tab str_repeat(" ",$i);
if(
$data[$parent])
{
$html "$tab<ol class='sortable' id='sortable'>";
$i++;
foreach(
$data[$parent] as $v)
{
$child menuList($data$v->id);
$html .= "$tab<li><div>";
$html .= '<a href="'.$v->url.'">'.$v->title.'</a>';

if(
$child)
{
$i--;
$html .= $child;
$html .= "$tab";
}
la siguiente
$html 
.= '</div></li>';
}
$html .= "$tab</ol>";
return 
$html;
}
else
{
return 
false;
}
}
$query mysql_query("SELECT * FROM menus ORDER BY sort");

while(
$r=mysql_fetch_object($query))
{
$data[$r->parent_id][] = $r;
}

$menu menuList($data);

echo 
$menu;
?> 
el error:

Undefined index: 8 in linea
Código PHP:
"if($data[$parent]"