Código PHP:
<?php
$ParamIdVeh=$row[5];
$sentencia="SELECT Vehiculo, Orden, Articulo, Descripcion, Cantidad, Imagenweb1, Imagenweb2, Instruccion
FROM cr_guiaproductos
WHERE Vehiculo=$ParamIdVeh; ";
$resultado2= mysql_query($sentencia);
$bandera = 0; //Para comprobar si existen articulos para ese vehiculo
while ($registro=mysql_fetch_array($resultado2, MYSQL_NUM))
{
if($registro[1]!=$bandera) //Aqui lo comprobamos si existen
{
$bandera=$registro[1];
?>
<table width="95%">
<tr bgcolor="#CCCCCC">
<td width="25%">
Opción <?php echo $bandera; ?>
</td>
<td width="25%">
Artículo
</td>
<td width="25%">
Descripción
</td>
<td width="20%">
Cantidad
</td>
</tr>
</table>
<?php
$mas=0; } // el valor de mas condiciona si ponemos la imagen mas o no
if($mas==0) // Si mas vale 0 no ponemos el mas pero si entra ponemos el mas en 1
{
?>
<table width="95%">
<tr>
<td width="25%">
<img src="http://www.forosdelweb.com/f18/images/productos/MINI/<?php echo $registro[5];?>" border="0">
</td>
<td width="25%" align="left">
<img src="images/pdf_button.png" border="0"> <?php echo $registro[2];?>
</td>
<td width="25%">
<?php echo $registro[3];?>
</td>
<td width="20%" align="left">
<?php echo $registro[4];?>
</td>
</tr>
</table>
<?php
$mas=1;
}
else // Aqui mas es diferente de 0 osea 1 y ponemos la imagen
{
?>
<table width="95%">
<tr>
<td width="25%">
<img src="guia/images/mas_azul.jpg">
<img src="http://www.pagina.com/images/productos/MINI/<?php echo $registro[5];?>" border="0"> </td>
<td width="25%" align="left">
<img src="images/pdf_button.png" border="0"> <?php echo $registro[2];?>
</td>
<td width="25%">
<?php echo $registro[3];?>
</td>
<td width="20%" align="left">
<?php echo $registro[4];
?> </td>
</tr>
</table>
<?php
$mas=1;
}
}
?>