Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/04/2013, 02:27
pr0
 
Fecha de Ingreso: marzo-2004
Mensajes: 687
Antigüedad: 20 años
Puntos: 28
Respuesta: Pintar titulo y luego productos de tabla mysql

Yo probaría con algo como lo siguiente:

Código PHP:
Ver original
  1. $rs = mysql_query("SELECT * FROM productos_stock ORDER BY tipo, marca");
  2.  
  3.   <? while($row = mysql_fetch_assoc($rs)){ ?>  
  4.                    
  5.                     $tipo = $row['tipo'];
  6.  
  7.                     if ($tipo != $tipo_anterior){
  8.                         echo '<h1>'.$tipo.'</h1>';
  9.                         $tipo_anterior = $tipo;
  10.                     }
  11.  
  12.                    <tr>                        
  13.                         <td><?php echo $row['ref_interna'];?></td>
  14.                         <td><?php echo $row['nombre'];?></td>
  15.                         <td><?php echo $row['marca'];?></td>
  16.                         <td><?php echo $row['capacidad'];?> Kgs.</td>                                    
  17.                     </tr>
  18.   <? }?>