Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/06/2012, 10:59
elgoncho99
 
Fecha de Ingreso: junio-2012
Ubicación: Argentina - Buenos Aires
Mensajes: 135
Antigüedad: 11 años, 11 meses
Puntos: 32
Respuesta: Suma de campos por campo correspondiente

Pone el if antes

Código PHP:
Ver original
  1. $un = -1;
  2.  $totiva = 0;
  3.  while ($fila=mysql_fetch_array($fila_campos))
  4.     {
  5.         if($fila['numero'] != $un )
  6.         {
  7.             if($un != -1)
  8.             {
  9.                 echo "<tr><td colspan='7'>Total IVA:'".$totiva."'</td></tr>";
  10.             }
  11.             $un = $fila['numero'];
  12.             $totiva = 0;
  13.         }
  14.         else{
  15.             $totiva = $totiva + $fila['iva'];
  16.         }
  17.         echo "
  18.  
  19.        <tr>
  20.          <td><div>".$fila['numero']."</div></td>
  21.          <td><div>".$fila['nombre']."</div></td>
  22.          <td><div>".$fila['direccion']."</div></td>
  23.          <td><div>".$fila['telefono']."</div></td>
  24.          <td><div>".$fila['producto']."</div></td>
  25.          <td><div>".$fila['costo']."</div></td>
  26.          <td><div>".$fila['iva']."</div></td>                    
  27.        </tr>";    
  28.  
  29.     }
__________________
http://www.latinium.com.ar/