Ver Mensaje Individual
  #12 (permalink)  
Antiguo 14/10/2010, 09:26
troyer4
 
Fecha de Ingreso: septiembre-2010
Mensajes: 22
Antigüedad: 13 años, 7 meses
Puntos: 0
Respuesta: Problemas con Array

Lo q necesito es controlar el ciclo q me genera el reporte, necesito q agrupe por numeros de camion y me muestre el subtotal de esos camiones.

ejemplo:

Truck# Total
514 300
514 200
subtotal 500

525 300
subtotal 300

587 100
587 200
subtotal 300

Este es el cliclo con el q genero el reporte:

$registros2=mysql_query("select invotemp.*, ite.* from invoicestemp invotemp, items ite where invotemp.brodri='$_REQUEST[idtruck]' and invotemp.item=ite.item and invotemp.ccost=ite.ccost and invotemp.date>='$_REQUEST[fechaini]' and invotemp.date<='$_REQUEST[fechafin]' order by truck",$link);

while ($fila=mysql_fetch_array($registros2)) {
echo "<tr align='center'>
<td>".$fila['date']."</td>
<td>".$fila['customer']."</td>
<td>".$fila['truck']."</td>
<td>".$fila['ticket']."</td>
<td>".$fila['fromitem']."</td>
<td>".$fila['toitem']."</td>
<td>".$fila['lth']."</td>
<td>".$fila['cbd']."</td>
<td>".$fila['amount']."</td>
</tr>";

Creo q haciendo un ciclo for puedo controlar el ciclo y q compare el primer registro con los demas y despues el segundo con los demas y asi hasta q termine y agrupe los q son del mismo numero de camion (Truck #), solo q no se como colocar el For??????