Hola a todos una consulta que me esta liando cualquier cantidad.....
Tengo tres familias por ejemplo:(Lo obtengo de una consulta a una tabla... y me sale Bien)
* Monitores
* Impresoras
* Multimedia
Ahora cuando selecciono por ejemplo la familia Impresoras o cualquier otra me salen sus subfamilias, hasta aca no tengo problemas.
* Monitores
* Impresoras
- Matricial
- Inyeccion
- Laser
* Multimedia
El problema es el siguiente
Una Tabla tengo dos columnas A y B
en la Colunma A me displayan las Familias y las sub familias y en la Columna B los articulos cuando selecciono las sub familias.
Cuando seleccione la Opcion Inyeccion me sale en la columna B los articulos que pertenecen a la Sub Familia (Inyeccion)
==========================================
* Monitores |Impresora Epson Inyeccion BC400
* Impresoras |Impresora Epson Inyeccion BC410
- Matricial |Impresora Epson Inyeccion BC420
- Inyeccion |.....
- Laser |
* Multimedia |
==========================================
PERO LA COLUMNA A REGRESA NUEVAMENTE A
==========================================
* Monitores |Impresora Epson Inyeccion BC400
* Impresoras |Impresora Epson Inyeccion BC410
* Multimedia |Impresora Epson Inyeccion BC420
==========================================
Y YO QUIERO QUE ME MUESTRE SIEMPRE LAS SUB FAMILIAS Y NO SALTE A LAS FAMILIAS.
==========================================
* Monitores |Impresora Epson Inyeccion BC400
* Impresoras |Impresora Epson Inyeccion BC410
- Matricial |Impresora Epson Inyeccion BC420
- Inyeccion |.....
- Laser |
* Multimedia |
==========================================
Te envio el codigo.
Gracias
<?php
include("Php/config.php");
$cod=$_GET['codi_fami']; $ok=$_GET['ban'];
$sub=$_GET['codi_sub'];
$consulta =mysql_query("SELECT * FROM familias order by nom_fam ",$conectar);
$consu=mysql_query("SELECT cod_sub_fam,nom_sub_fam FROM sub_familias WHERE cod_fam='$cod'",$conectar);
$cons_articulo=mysql_query("SELECT * FROM articulos WHERE cod_sub_fam='$sub'",$conectar);
//echo $cod."<br>"; echo $ok;
?>
************************************************** ********
ESTE ES EL CODIGO PARA LAS FAMILIAS Y SUB FAMILIAS
<?php
while ($fam=mysql_fetch_array($consulta))
{echo "<tr>";
echo "<td height='22'>";
echo '<div align="left">';
echo "<span class='Estilo101'><img src='Imagenes/boton_mas.jpg' width='9' height='9'> <a href=\"cat_ventas.php?codi_fami=$fam[cod_fam]&ban=1\">$fam[nom_fam]</a></span>";
echo "</div>";
if ($ok==1)
{ if ($cod==$fam['cod_fam'])
{echo "<table border='0' align='left' cellpadding='0' cellspacing='0' >";
while ($subfam=mysql_fetch_array($consu))
{echo "<tr>";
echo "<td height='18'>";
echo '<div align="left">';
echo "<span class='Estilo103'>...</span> "."<span class='Estilo102'><img src='Imagenes/boton_ir.gif' width='11' height='11'> <a href=\"cat_ventas.php?codi_sub=$subfam[cod_sub_fam]&ban=1\">$subfam[nom_sub_fam]</a></span>";
echo "</div>";
echo "</td>";
echo "</tr> ";
}
echo "</table>";
}
}
echo "</td>";
echo "</tr> ";
}
?>
************************************************** ********
ESTA ES LA CONSULTA DE LOS ARTICULOS EN LA COLUMNA B
<?php
echo "<table width='360' border='0' cellspacing='0' cellpadding='0'>";
while ($art=mysql_fetch_array($cons_articulo))
{
echo "<tr>";
echo "<th colspan='2' scope='col'><div align='left'>"."<span class='Estilo101'>".$art['nom_art']."</span>"."</div></th>";
echo "</tr>";
echo "<tr>";
echo "<th rowspan='2' scope='col'><img src= Archivos/".$art['ima1']."></th>";
echo "<th scope='col'><div align='left'>"."<span class='Estilo104'>"."Código : ".$art['cod_art']."</span>"."</div></th>";
echo "</tr>";
echo "<tr>";
echo "<th scope='col'><div align='left'>"."<span class='Estilo104'>"."Precio : ".$art['pre_art']."</span>"."</div></th>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='2' scope='col'> </th>";
echo "</tr>";
}
echo "</table>";
?>