Muchas gracias Ing_FOFO, el código es el siguiente:
Código PHP:
<?
function barra_link($cat,$txt)
{
$sql = "SELECT id,area,nombre FROM Categorias WHERE id = '$cat';";
$cad = mysql_query($sql) or die ('ERROR 7:'.mysql_error());
$array = mysql_fetch_array($cad);
if($cat == 1)
{
$txt = substr($txt,10);
echo $txt;
}
else
{
$txt = " > <a href='anuncios.php?cat=".$array['id']."' class='Estilo16'>".$array['nombre']."</a>".$txt;
barra_link($array['area'],$txt);
}
}
function subareas($cat)
{
$sql = "SELECT id,nombre FROM Categorias WHERE area = '$cat';";
$cad = mysql_query($sql) or die ('ERROR 7:'.mysql_error());
$aux['error'] = false;
if(mysql_num_rows($cad) == 0)
{
$aux['error'] = true;
}
while($array = mysql_fetch_array($cad))
{
$aux[] = $array['id'];
}
return $aux;
}
function datos_categoria($cat)
{
$sql = "SELECT nombre FROM Categorias WHERE id = '$cat';";
$cad = mysql_query($sql) or die ('ERROR 7:'.mysql_error());
$array = mysql_fetch_array($cad);
return $array['nombre'];
}
?>