Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/10/2004, 15:29
Avatar de MaBoRaK
MaBoRaK
 
Fecha de Ingreso: abril-2003
Ubicación: La Paz - Bolivia
Mensajes: 2.003
Antigüedad: 21 años
Puntos: 35
loading.....



Por dios esto es como buscar una arena de color blanca en la playa
Ayudate a todos y a ti mismo poniendo todo entre codigos PHP no por nada está ahi los bbcodes que tanto trabajo cuesta hacer.
Código PHP:
<?php
include("Php/config.php");
$cod=$_GET['codi_fami'];
$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);

$consul mysql_query("SELECT * FROM articulos WHERE cod_sub_fam='$sub'",$conectar);
?>

codigo html....

<?php
while ($fam=mysql_fetch_array($consulta))
{echo 
"<tr>";
echo 
"<td height='22' bgcolor='#FFDF7D' width='230' >";
echo 
'<div align="left">';
echo 
"<img src='Imagenes/boton_mas.jpg'>";
echo 
" <a href=\"cat_ventas.php?codi_fami=$fam[cod_fam]\">$fam[nom_fam]</a>";
echo 
"</div>";

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' bgcolor='#CCCCCC' width='230' >";
echo 
'<div align="left">';
echo 
"<img src='Imagenes/boton_ir.gif'>";
echo 
"<a href=\"cat_ventas.php?codi_sub=$subfam[cod_sub_fam]\">$subfam[nom_sub_fam]</a>";
echo 
"</div>";
echo 
"</td>";
echo 
"</tr> "
}
echo 
"</table>";

}
echo 
"</td>";
echo 
"</tr> "
}
?>
</table></th>
<th width="365" valign="top" bgcolor="#FFFFFF" scope="col">
<?php
//** ESTA ES LA RUTINA PARA QUE CUANDO PRESIONE LA SUB FAMILIA ME MUESTRE SUS ARTICULOS ***** echo "<table width='365' border='0' align='center' cellpadding='0' cellspacing='0'>"; 
while ($art=mysql_fetch_array($consul))
{
echo 
"<tr>";
echo 
"<th height='23' colspan='2' ><div align='center'>";
echo 
"<table width='365' height='19' border='0' cellpadding='0' cellspacing='0' bgcolor='#DFDFDF'>";
echo 
"<tr>";
echo 
"<th width='14' height='19' scope='col'><img src='Imagenes/botoneraflecha2.gif' width='12' height='13'></th>";
echo 
"<th width='351' bgcolor='#DFDFDF' class='Estilo106' scope='col'><div align='left'>".$art['nom_art']."</div></th>";
echo 
"</tr>";
echo 
"</table>";
echo 
"</div></th>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<th width='100' height='83'><a href=\"cat_ventas_puntual.php?cod=".$art['cod_art']."\"><img src=\"thumbnail.php?ruta=Archivos/".$art['ima1']."\" border='0' alt='Mas Información'></th>";
echo 
"<th width='265'><table width='260' border='0' cellspacing='0' cellpadding='0'>";
echo 
"<tr>";
echo 
"<th width='65' scope='col'><div align='center' class='Estilo104'>";
echo 
"<div align='left'>Codigo</div>";
echo 
"</div></th>";
echo 
"<th width='12' scope='col'><div align='center'>:</div></th>";
echo 
"<th width='183' class='Estilo104' scope='col'><div align='left'>".$art['cod_art']."</div></th>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td><div align='center' class='Estilo104'>";
echo 
"<div align='left'>Precio</div>";
echo 
"</div></td>";
echo 
"<td><div align='center'>:</div></td>";
echo 
"<td><div align='left'><span class='Estilo106'>".$art['pre_art']."</span> <span class='Estilo104'>&euro; </span></div></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<td colspan='3'><div align='left' class='Estilo104'><form name='form1' method='post' action='cesta.php?action=add_item&id=$art[cod_art]'>
Comprar&nbsp;&nbsp; : <input name='txt_cantidad' type='text' id='txt_cantidad' value='1' size='3' maxlength='3'>
&nbsp;&nbsp;&nbsp;<input type='submit' name='A Cesta' value='Enviar'> </form> </div></td>"
;
echo 
"</tr>";
echo 
"</table>";
echo 
"</th>";
echo 
"</tr>";
}
echo 
"</table>";
//********************************************* FIN ?>

De la misma forma que muestras ala familia debes expandir el valor de la familia para mostrar la subfamilia caso contrario no sabrá de donde coger para mostrar a la subfamilia y a la familia.

Explica mejor como piensas usar eso que quieres hacer, y quita tantos "echo" que hay html en un 96% Deberías generarlo automáticamente no?.




connection closed.
__________________

Maborak Technologies

Última edición por MaBoRaK; 23/10/2004 a las 15:33