Foros del Web » Programando para Internet » PHP »

corregir problema con consulta

Estas en el tema de corregir problema con consulta en el foro de PHP en Foros del Web. tengo el siguinete codigo $bd=conectarse(); //aqui busca el turno de trabajo $nuevo=mysql_query("select * from asig_turnos_tra ",$bd); while($reg9=mysql_fetch_array($nuevo)) { $fecha = $reg9["fecha"]; list($dia,$mes,$anyo) = explode("-",$fecha); $fecha_finis ...
  #1 (permalink)  
Antiguo 28/04/2009, 09:29
 
Fecha de Ingreso: marzo-2009
Mensajes: 26
Antigüedad: 15 años, 1 mes
Puntos: 0
corregir problema con consulta

tengo el siguinete codigo

$bd=conectarse();
//aqui busca el turno de trabajo
$nuevo=mysql_query("select * from asig_turnos_tra ",$bd);
while($reg9=mysql_fetch_array($nuevo))
{
$fecha = $reg9["fecha"];
list($dia,$mes,$anyo) = explode("-",$fecha);

$fecha_finis = $reg9["fecha_end"];
list($dia_1,$mes_1,$anyo_1) = explode("-",$fecha_finis);

if (($dia == $d1) && ($mes == $m1) && ($dia_1 <= $d2) && ($mes_1 == $m2) )
{
$dato_ope = $reg9["identificacion"];
$consecutivo_turno = $reg9["consecutivo"];
echo $consecutivo_turno;

//aqui deacuerdo al turno se selecciona el ingreso
$usu_bd=mysql_query("select * from ingreso_turno where consecutivo='$consecutivo_turno' ",$bd);
while($reg_usu_bd=mysql_fetch_array($usu_bd))
{
$total_tvd+=$reg_usu_bd["TVD"];
$total_tvt+=$reg_usu_bd["TVT"];
$total_tvp+=$reg_usu_bd["TVP"];
$total_tvp_2+=$reg_usu_bd["TVP_2"];
$total_total+=$reg_usu_bd["TOTAL_SU"];
echo'
<tr class=select style="font-size:12px" bgcolor="'.$color.'">

<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.$reg_usu_bd["clientes"].'
</td>
<td>
&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVD"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVT"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVP"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TVP_2"]).'
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;
'.number_format($reg_usu_bd["TOTAL_SU"]).'
</td>
</tr>
';
//}
//}
if ($color=="#E4E4E4")
{
$color="#DEE7EB";
}else{
$color="#E4E4E4";
}
}
}
}

mysql_free_result($usu_bd);
mysql_close($bd);
echo'
<tr align=center bgcolor="'.$color.'">
<td>
<b>TOTAL<b>
</td>
<td>
<b>'.number_format($total_tvd).'<b>
</td>
<td>
<b>'.number_format($total_tvt).'<b>
</td>
<td>
<b>'.number_format($total_tvp).'<b>
</td>
<td>
<b>'.number_format($total_tvp_2).'<b>
</td>
<td>
<b>'.number_format($total_total).'<b>
</td>
</tr>

<tr>
<td width=100% colspan=4>
<table width=100%>
<tr><td width=85%>&nbsp;</td>
<td width=15% align=center>
<a class="ico" title="Imprimir lista" href="" onClick="return printPage2()"><img src="img2/ico_imprimir.png" width="18" height="18" border=0><br>Imprimir</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<META http-equiv=Refresh content="300; URL=login.php">
';
?>


bueno el me hace el trabajo pero si el cliente en el dia me realizo varias compra el las detalla no me las suma. lo que quiero yo es me sume las compras en total que realizo cada cliente. y solo ponga una sola vez el nombre del cliente.

si alguien me puede ayudar por favor
gracias
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:01.