ya lo soluciones forever
este es el codigo
Código PHP:
<?php include('conect.php');
$id_sub = -1;
if (isset($_REQUEST['id_cat']))
$id_sub = $_REQUEST['id_cat'];
$id_prod = -1;
if (isset($_REQUEST['id_sub']))
$id_prod = $_REQUEST['id_sub'];
$id_prod2 = -1;
if (isset($_REQUEST['id']))
$id_prod2 = $_REQUEST['id'];
$sql="SELECT * from categoria ORDER BY nombre ASC";
$sql_exec=mysql_query($sql) or die( "[ERROR] Query: $sql, error: " . mysql_error() );
$total = mysql_num_rows($sql_exec);
$sql2="SELECT * FROM subcategoria WHERE id_cat = $id_sub ORDER BY nombre ASC";
$sql_exec2=mysql_query($sql2) or die( "[ERROR] Query: $sql2, error: " . mysql_error() );
$sql3="SELECT * FROM productos WHERE id_sub = $id_prod";
$sql_exec3=mysql_query($sql3) or die( "[ERROR] Query: $sql3, error: " .mysql_error() );
$sql4="SELECT * FROM productos WHERE id = $id_prod2";
$sql_exec4=mysql_query($sql4) or die( "[ERROR] Query: $sql4, error: " .mysql_error() );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="750" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="250"><table width="250" border="0" cellspacing="0" cellpadding="0">
<tr><?php if ($total > 0) { ?> <?php while($row=mysql_fetch_assoc($sql_exec)){ ?>
<td><a href="ficha_cat.php?id_cat=<?php echo $row['id']; ?>"><?php echo $row['nombre']; ?></a> </td>
</tr><?php } ?>
<?php } else {
echo ("No hay categorias para mostrar");
} ?>
</table></td>
<td width="429" valign="top"><table width="250" border="0" cellspacing="0" cellpadding="0">
<tr><?php
if ($id_sub > 0) { ?><?php while($row2=mysql_fetch_assoc($sql_exec2)){ ?>
<td valign="top">
<a href="ficha_cat.php?id_cat=<?php echo $row2['id_cat']; ?>&id_sub=<?php echo $row2['id_sub']; ?>"><?php echo $row2['nombre']; ?></a> </td>
</tr><?php } ?><?php } else { echo ("Debe seleccionar una Subcategoria");
} ?>
</table></td>
<td width="71"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
if ($id_prod > 0) { ?>
<?php while($row3=mysql_fetch_assoc($sql_exec3)){ ?>
<td width="70"> </td>
<td width="230" align="center"><a href="ficha_cat.php?id_cat=<?php echo $row3['id_cat']; ?>&id_sub=<?php echo $row3['id_sub']; ?>&id=<?php echo $row3['id']; ?>"><?php echo $row3 ['nombre']; ?></a></td>
</tr>
<?php } ?>
<?php } else { echo ("Debe seleccionar una categoria");
} ?>
</table></td>
<td width="71"><table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<?php
if ($id_prod2 > 0) { ?>
<?php while($row4=mysql_fetch_assoc($sql_exec4)){ ?>
<td width="70" rowspan="4"> </td>
<td width="230" align="center"><a href="#" onclick="window.open('verimagen.php?id=<?=$id;?>;','verimagen', 'width=400,height=400'); return false;"><img src="images2/<?php echo $row4['imagen']; ?>" width="200" height="200" border="0"/></a></td>
</tr>
<tr>
<td align="center"><?php echo $row4['nombre']; ?></td>
</tr>
<tr>
<td align="center"><?php echo $row4['codigo']; ?></td>
</tr>
<tr>
<td align="center"><div align="justify"></div>
<?php echo $row4['descripcion']; ?></td>
</tr>
<?php } ?>
<?php } else { echo ("Debe seleccionar una categoria");
} ?>
</table></td>
</tr>
</table>
</body>
</html>
y el funcionamiento lo puedes ver aqui
http://indexa.com.ve/flamuko/prueba/ficha_cat.php
gracias