Pues mirar,tengo este codigo:
Código PHP:
function mostrar_productos($categoria){
global $host;
global $usuariodb;
global $contrasenadb;
global $basedatos;
$raiz=$_SERVER['document_root'];
conectardb($host,$usuariodb,$contrasenadb,$basedatos);
$sqlrelcat="SELECT producto FROM rel_cat_pro WHERE categoria='$categoria'";
$queryrelcat= mysql_query($sqlrelcat);
$cuenta= mysql_num_rows($queryrelcat);
if($cuenta == 0){
echo "<p>No hay productos en esta categoria</p>";
}
for($c=1;$c<= mysql_num_rows($queryrelcat);$c++){
$resultadorelcat= mysql_fetch_array($queryrelcat);
$sqlproducto="SELECT * FROM productos WHERE id='$resultadorelcat[0]'";
$queryproducto= mysql_query($sqlproducto);
for($b=1;$b<= mysql_num_rows($queryproducto);$b++){
$resultadoproductos= mysql_fetch_array($queryproducto);
echo "<table width='750px' style='border-top: 1px solid #000000;border-bottom: 1px solid #000000;'>";
echo "<tr><td style='padding-left:20px;'><font style='font-weight: bold;color: #e98d2b;font-family: Verdana;font-size:0.8em;'>Producto: </font><font style='color: #000000;font-weight: bold;font-family: Verdana;font-size:0.8em;'>".$resultadoproductos[1]."</font></td><td width='100px'><form method='post' action='ac.php?pro=$resultadoproductos[0]&cat=$categoria&vo=s'><p class='enlinea'>Cantidad</p> <input type='text' name='cantidad' size='1' /><input type='submit' name='anadir' value='Añadir a carrito' style='margin-top: 3px;background-color:#e74a49;' /></form></td></tr>
<tr><td style='padding-left:60px;'><font style='font-weight: bold;color: #e98d2b;font-family: Verdana;font-size:0.8em;'>Descripcion: </font><font style='color: #000000;font-weight: bold;font-family: Verdana;font-size:0.8em;'>".$resultadoproductos[2]."</font></td></tr>
<tr><td style='padding-left:120px;'><font style='font-weight: bold;color: #e98d2b;font-family: Verdana;font-size:0.8em;'>Precio: </font><font style='color: #000000;font-weight: bold;font-family: Verdana;font-size:0.8em;'>".$resultadoproductos[3]." €</font><td style='vertical-align: center;' rowspan='5' width='20px'><img src='$raiz.$resultadoproductos[5]' /></td></td></tr>
<tr><td style='padding-left:60px;'><font style='font-weight: bold;color: #e98d2b;font-family: Verdana;font-size:0.8em;'>Stock: </font><font style='color: #000000;font-weight: bold;font-family: Verdana;font-size:0.8em;'>".$resultadoproductos[4]." Unidades</font><br /><font style='font-weight: bold;color: #e98d2b;font-family: Verdana;font-size:0.8em;'>Ref. </font><font style='color: #000000;font-weight: bold;font-family: Verdana;font-size:0.8em;'>".$resultadoproductos[0]."</font>"."</td></tr>";
echo "</table>";
}
}
}
Alguien podria decirme como lo implemento..?
Un Saludo y muchas gracias!!