NECESITO AYUDA
SOY NOVATO EN EL PHP Y ME ENCUENTRO CON EL SIGUIENTE PROBLEMA. AL EJECUTAR EL SIGUIENTE CODIGO:
$annio=$_POST['anio'];
for ($i=1;$i<13;$i++){
$sql="Select sum(t_presupuestos_7_1.ocupacion) as ocupacion , sum(t_presupuestos_7_1.ingresos) as ingresos from t_presupuestos_7_1 where mes=".$i." and anio=".$annio." and (";
for($j=0;$j<count($arestablecimientos);$j++)
{
$sql=$sql."idestablecimiento=".$arestablecimientos[$j].")"; }
$datos=mysql_query($sql);
$rdatos=@mysql_fetch_array($datos);
echo "<td align='right'>".number_format(@($rdatos['ingresos']/$rdatos['ocupacion']),2,',','.')."</td>";
//del for
}
ME HACE BIEN EL CALCULO PERO ME INSERTA UN VALOR 0,00 ANTES DE CADA VALOR CORRECTO
COMO DIABLOS PUEDO QUITARLO PUESTO QUE LOS RESULTADOS SON CORRECTOS.
GRACIAS
$annio=$_POST['anio'];
for ($i=1;$i<13;$i++){
$sql="Select sum(t_presupuestos_7_1.ocupacion) as ocupacion , sum(t_presupuestos_7_1.ingresos) as ingresos from t_presupuestos_7_1 where mes=".$i." and anio=".$annio." and (";
for($j=0;$j<count($arestablecimientos);$j++)
{
$sql=$sql."idestablecimiento=".$arestablecimientos[$j].")"; }
$datos=mysql_query($sql);
$rdatos=@mysql_fetch_array($datos);
echo "<td align='right'>".number_format(@($rdatos['ingresos']/$rdatos['ocupacion']),2,',','.')."</td>";
//del for
}
ME HACE BIEN EL CALCULO PERO ME INSERTA UN VALOR 0,00 ANTES DE CADA VALOR CORRECTO
COMO DIABLOS PUEDO QUITARLO PUESTO QUE LOS RESULTADOS SON CORRECTOS.
GRACIAS
