I have the following question and you can not help me.
I have this table in the BD, it is a record of assistances that keeps the time of entry to work, time of entry to lunch, lunch, work output.
In the table there is stored data in the following way
What I want to do is the following:
Subtract the following columns:
hora_s_labor - hora_i_labor = DATA1 (result of hours of work)
hora_s_alm - hora_i_alm = DATO2 (result of lunch hours)
DATA1 - DATA2 = Hours worked daily
At the end of the operations I want to print the total sum of the hours worked daily.
THIS IS MY CODE THAT SHOWS ONLY THE DATA FROM THE BD:
<?php $querybase = "SELECT * FROM asistencias WHERE user_dni = '$f_user' AND MONTH(fecha) = '$f_mes' AND YEAR(fecha) = '$f_anio' ORDER BY fecha";
$resultado = mysqli_query($conexion,$querybase); ?>
<table id="data-table">
<thead>
<tr>
<th>DNI</th>
<th>FECHA</th>
<th>Hora Inicio A</th>
<th>Hora Salida A</th>
<th>Hora Inicio R</th>
<th>Hora Salida R</th>
</tr>
</thead>
<tbody>
<?php
if ($result1) {
while($row = mysqli_fetch_assoc($result1)){ ?>
<tr>
<td><?php echo $row['asis_user_dni']; ?></td>
<td><?php echo $row['asis_fecha']; ?></td>
<td><?php echo $row['asis_hora_i_labor']; ?></td>
<td><?php echo $row['asis_hora_i_alm']; ?></td>
<td><?php echo $row['asis_hora_s_alm']; ?></td>
<td><?php echo $row['asis_hora_s_labor']; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>