I make a payroll system, this in my module where I look for a control No. (field id_Control), what I intend to do is to make a sum of hours with the field (time) but it is from the same control number (control_id) , doing the search by Control No. (field control_id) by clicking on the calculate button and showing them to my interface.
Annex Code.
These are my fields in my "clock" table
id
id_Control
fecha
hora
Thanks / Regards
<?php
include('conexion.php');
$dato = $_POST['dato'];
//EJECUTAMOS LA CONSULTA DE BUSQUEDA
$registro = mysql_query("SELECT * FROM reloj WHERE id_Control = '$dato' ORDER BY id ASC");
//CREAMOS NUESTRA VISTA Y LA DEVOLVEMOS AL AJAX
echo '<table class="table table-striped table-condensed table-hover">
<tr>
<th width="300">No. De Control</th>
<th width="200">Fecha</th>
<th width="150">Hora</th>
</tr>';
if(mysql_num_rows($registro)>0){
while($registro2 = mysql_fetch_array($registro)){
echo '<tr>
<td>'.$registro2['id_Control'].'</td>
<td>'.$registro2['fecha'].'</td>
<td>'.$registro2['hora'].'</td>
</tr>';
}
}else{
echo '<tr>
<td colspan="6">No se encontraron resultados</td>
</tr>';
}
echo '</table>';
?>