Notice: Undefined offset: 5

0

explain: that error I get when I want to access data conditioned by date and type of expense, how much I spent on a provider that day, here the code to make it more understandable, to start using Smarty PHP a framework that is quite outdated.

    if (isset($_GET['fecha']) and $_GET['fecha']!="")
{
    $fecha=$_GET['fecha'];
}
else
{
    $fecha=date("Y-m-d");
}


$mes=substr($fecha,5,2);
$anyo=substr($fecha,0,4);
$cant_dias_mes = cal_days_in_month(CAL_GREGORIAN, $mes, $anyo); // 31
$primer_dia_mes="01";
$ultimo_dia_mes= $cant_dias_mes;




$obj_proveedores=lista_proveedores('', $conn);

$gastos_total=0;

for ($a=0;$a<=$cant_dias_mes;$a++)
{
    // Calculamos el dia
    $nuevafecha = strtotime ( '+'.$a.' day' , strtotime ( $anyo."-".$mes."-01" ) ) ;
    $fecha_temp=date ( 'Y-m-d' , $nuevafecha );
    $fecha_array[$a]=$fecha_temp;
    $dia_mes[$a]=$a+1;

    for ($b=0; $b < $obj_proveedores['count']; $b++) { 
        $obj_gastos[$a][$b]=carga_gastos($fecha_temp, $obj_proveedores[$b]['id_proveedor'],'', $conn);

        for ($c=0; $c < $obj_gastos[$a][$b]['count']; $c++) {
            if ($obj_gastos[$a][$b][$c]['tipo'] == 10) {
                $obj_gastos = $obj_gastos[$a][$b][$c];
                // var_dump($obj_gastos[$a][$b][$c]);
            } 
        }
    }
    // Gastos
}
// var_dump($obj_gastos);

$fecha=substr($fecha,0,7);

the error jumps in the third for ($c) ...

    
asked by juank 27.12.2018 в 18:27
source

0 answers