Ver Mensaje Individual
  #12 (permalink)  
Antiguo 15/06/2012, 10:20
Avatar de oscartt67
oscartt67
 
Fecha de Ingreso: abril-2012
Ubicación: fonollosa
Mensajes: 481
Antigüedad: 12 años
Puntos: 97
Respuesta: crear menu dinamico con php y mysql

Mira, como hace mucho calor para ir a atar las tomateras, te lo he reescrito con mysql.
Código PHP:

$elmenu
=Menu();


function 
Menu($pId=0){
    
$result mysql_query("select id,linklabel from menu where parentid=$pid");
    if(empty(
$result)){return "";}
    while (
$row mysql_fetch_array($result)) {
        
$menu.="<li><a href=\"{$row['id']}\">{$row['linklabel']}</a></li>";
        
$menu.=Menu($row['id']);
    }
    
$menu="<ul>$menu</ul>";
    if(
$pId==0){$menu="<div>$menu</div>";}
    return 
$menu;

Saludos.