Tunee la consulta para que no me muestre marcas de las que no haya productos:
Código:
<?php
include ("conexion.php");
$conexion = mysql_connect ($host, $user, $pass);
mysql_select_db ($base, $conexion);
$resultm = mysql_query("select distinct PRO.id_marca as idm, MAR.nombre as marca from matermec_productos PRO
inner join matermec_marcas MAR
on PRO.id_marca=MAR.id
order by marca asc", $conexion);
while ($rowm=mysql_fetch_array($resultm)) {
echo $rowm["marca"]."<br>";
$resultp = mysql_query("select * from matermec_productos where id_marca=".$rowm["idm"]." order by id asc", $conexion);
while ($rowp=mysql_fetch_array($resultp)) {
echo $rowp["nombre"]."<br>";
}
}
?>