Ver Mensaje Individual
  #5 (permalink)  
Antiguo 26/10/2012, 09:22
lac
 
Fecha de Ingreso: octubre-2012
Ubicación: El Salvador
Mensajes: 27
Antigüedad: 11 años, 6 meses
Puntos: 0
Respuesta: Menu generado automáticamente con php y mysql

Recién estaba testeando la aplicación y me daba un pequeño problema pero ya lo solucione, dejo el código completo.

Código PHP:
<?php
                    $dbf 
= new db_functions($cfg_server$cfg_username$cfg_password$cfg_database);
                    
$select ="select * from menuusuario where id_usuario =".$idU;
                    
$select1="select * from menuusuario where nivel = 2";
                    
$select2="select max(correlativo) from menuusuario where id_usuario =".$idU;
                    
$maxCorrelativo $dbf->getConsulta($select2);
                    
$resulta=$dbf->getConsulta($select);
                    
                    for (
$i=0$i $maxCorrelativo$i++) { 
                    
                        
                        while (
$row=mysql_fetch_array($resulta)){
                            if (
$row[nivel]==1){
                                        
                                    echo 
"<div title='$row[nombremenu]' style='overflow:auto;' id='menus'>
                                        <br>"
;
                                        
                                
$resulta1=$dbf->getConsulta($select1);
                                
$id;
                                while (
$row1=mysql_fetch_array($resulta1)) {
                                    if (!
in_array($row1[idmenu], $id)) {
                                        if (
$row1['correlativo'] == $row['correlativo']) {
                                            echo 
"<img src='../themes/default/images/flecha-derecha.png' alt='mg_modUsuario' width='20'/> <a href='$row1[url]' class='menu'>$row1[nombremenu]</a><br><br>";
                                            
$id[]=$row1[idmenu];
                                        }
                                    }
                                }
                                echo 
"</div>";
                            } 
                        }
                    } 
                
?>