Validate absences with php

1

Hi chic @ s I have a question about how to show a data that does not exist in the database ... I explain I have an arrangement in which I keep the students' attendance which is separated by id, date, entry and exit $ fecha2 is a validation to filter by a predetermined date ...

$co= true;
        $co1= 0;
        $co2= 0;
        while ($co=true) {
            if ($c2[$co1][0]==null) {
                $co= false;
                break;
            }
            if ($co2 == 2) {
             $arreglo2[$co2][0] = $arreglo1[$co1][0];  //id
             $arreglo2[$co2][2] = $arreglo1[$co1][2];  //fecha
             $arreglo2[$co2][3] = $arreglo1[$co1][3];  //entrada
             $arreglo2[$co2][4] = $arreglo1[$co1][4];  //salida
            }
             else {
                   //aqui hace el filtrado por fecha y la cual funciona bien... el problema es que si un alumno tiene alguna falta osea no tiene un registro del día.. esto afecta el orden de la vista... ya que todo se recorre hacia arriba...
           if ($fecha2=== $c2[$con25][2]) {
             $co2++;
                 $arreglo2[$co2][0] = $arreglo1[$co1][0];  //id
                 $arreglo2[$co2][2] = $arreglo1[$co1][2];  //fecha
                 $arreglo2[$co2][3] = $arreglo1[$co1][3];  //inicio
                 $arreglo2[$co2][4] = $arreglo1[$co1][4];  //salida
                            }else {
//aquí trato de comparar las inasistencias ya que al tener un alumno alguna... los registros se recorren hacia arriba... bueno esto afecta la vista de una tabla que se obtiene en en html... 
                            if (($fecha2 === $arreglo1[$co1][2]) == null) {
                         $co2++;
                 $arreglo2[$co2][0] = 0;  //id
                 $arreglo2[$co2][2] = 0;  //fecha
                 $arreglo2[$co2][3] = 0;  //inicio
                 $arreglo2[$co2][4] = 0;  //salida
                                      }
                               }
                        }
        $co1++;
        }

// simulation of the database table

Student ID Assist
1 2018-11-01

2 2018-11-01

4 2018-11-01

5 2018-11-01

6 2018-11-01

7 2018-11-01

8 2018-11-01

10 2018-11-01

Student ID Assist

2 2018-11-02

3 2018-11-02

4 2018-11-02

5 2018-11-02

9 2018-11-02

11 2018-11-02

12 2018-11-02

I hope you can help me greetings ....

    
asked by Pedro185 13.11.2018 в 23:07
source

1 answer

0

Do you have the class duration period? first you must know what are all the dates of the course, if you do not have it, you have a distinct to the dates of the students of that course ... (it seems that there can be many cases here)

then just compare, if the date exists attended if there is no did not attend. I show you the opposite logic I keep the absences

               foreach ($Ina->Est() as $columna => $row) {
                            $stmtFechas = $Ina->Inansistencia($row['ESTID']);
                            //Es activo el estudiante
                            if ($row['Estado'] == 1) {
                                echo"<tr id='" . $row['ESTID'] . "' ><td style='font-size: 70%;'>" . utf8_encode($row['NOMBRE']) . "</td>";
                                foreach ($stmtFechas as $columna2 => $row2) {
                                    if ($row2['falto'] == 1) {
                                        echo"<td value='" . $row2['fecha'] ."' class='text-center selected'><input type='checkbox' checked></td>";
                                    } else {
                                        echo"<td value='" . $row2['fecha'] . "' class='text-center'><input type='checkbox'></td>";
                                    }
                                }
                            } else {
                                echo"<tr class='danger'><td style='font-size: 70%;'>" . utf8_encode($row['NOMBRE']) . "</td>";
                                foreach ($stmtFechas as $columna2 => $row2) {
                                    if ($row2['falto'] == 1) {
                                        echo"<td  value='" . $row2['fecha'] . "' class='text-center selected' ><input type='checkbox' checked disabled></td>";
                                    } else {
                                        echo"<td  value='" . $row2['fecha'] . "' class='text-center'><input type='checkbox' disabled></td>";
                                    }
                                }
                            }
                            echo '</tr>';
                        }

Greetings

    
answered by 14.11.2018 в 21:39