Las partes del menú son:
- Tipo
- Subtipo
- Marca
- Modelo
Las tablas son así.
Código MySQL:
Ver original
Código MySQL:
Ver original
Código MySQL:
Ver original
Código MySQL:
Ver original
Explico!
La tabla tipo es la principal
Subtipo pertenece al Tipo, o sea debe obtener su id
La tabla Marca no posee a ninguno (no se a cual unirlo)
La tabla modelo posee a los 3
La forma en la que estoy haciendo la llamada es la siguiente:
Código PHP:
Ver original
<?php include("admin/conexion2.php"); $linke=conectar2(); echo " <li><a href='#'>".$row_a["ti_name"]."</a> <ul class='horizontal'>"; $tipo=$row_a["id_tipo"]; echo " <li><a href='#'>".$row["su_name"]."</a>"; echo"<div class='extended'>"; echo"<ul class='smallNav'>"; $subtipo=$row["id_subtipo"]; $marca=$row_m["id_marca"]; $result_e=mysql_query("select * from t_modelos WHERE id_subtipo=".$subtipo." AND id_marca=".$marca." ORDER BY id_modelo ;",$linke) or die( "Error en query: $linke, el error es: " . mysql_error() ); $desat=" "; if ($row_e["id_marca"]=='4'){ $desat.="<a href='index2.php'><img src='images/marca-1.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='5'){ $desat.="<a href='index2.php'><img src='images/marca-2.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='6'){ $desat.="<a href='index2.php'><img src='images/marca-3.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='7'){ $desat.="<a href='index2.php'><img src='images/marca-4.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='8'){ $desat.="<a href='index2.php'><img src='images/marca-5.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='9'){ $desat.="<a href='index2.php'><img src='images/marca-6.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='10'){ $desat.="<a href='index2.php'><img src='images/marca-7.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='11'){ $desat.="<a href='index2.php'><img src='images/marca-8.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='12'){ $desat.="<a href='index2.php'><img src='images/marca-9.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='13'){ $desat.="<a href='index2.php'><img src='images/marca-10.png' height='30' align='center' border='0'/>"; } if ($row_e["id_marca"]=='14'){ $desat.="<a href='index2.php'><img src='images/marca-11.png' height='30' align='center' border='0'/>"; } echo"<li><b style='font-size:14px'>".$desat."</b></li>"; } } echo"</ul></div></li>";} echo"</ul> </li>";} ?>
El problema es el siguiente! cuando tengo modelos cargados entonces aparecen siempre la marca. Quiero que salga una sola vez la marca y despues salgan los modelos (la cantidad que sean) no que se repitan las marcas siempre.
Gracias de antemano!