I need to overlap records in the same query of a table.
The records in the table are as follows:
|---|--------|----------------|------------|-----------------|----------------|-----------------|----------------|
|Id | Nombre | E-mail | Fecha | Hora de Entrada | Hora de Comida | Hora de Regreso | Hora de Salida |
|---|--------|----------------|------------|-----------------|----------------|-----------------|----------------|
|28 | Carlos | Carlos90@gmail | 2008-07-17 | 00:37:42 | 00:00:00 | 00:00:00 | 00:00:00 |
|29 | Carlos | Carlos90@gmail | 2008-07-17 | 00:00:00 | 00:00:00 | 00:00:00 | 00:37:49 |
|---|--------|----------------|------------|-----------------|----------------|-----------------|----------------|
Below I share the code with which you enter the time of entry:
include "../Funciones/Conexion.php";
$mysqli = inicio();
$nombre = $_POST["nombre"];
$email = $_POST["email"];
$fecha = date('d/m/y');
$hora = date('H:i:s');
$sql = "INSERT INTO chequeo (nombre,email,fecha,hora)
VALUES ('$nombre','$email','$fecha','$hora');";
$query = mysqli_query($mysqli,$sql);
if ($query){
echo "<script>alert(\"Exito al registrar.\"); </script>";
echo "<script>location.href='../Usuario.php'</script>";
} else {
echo "<script>alert(\"Error al registrar\"); </script>";
echo "<script>location.href='../Usuario.php'</script>";
I also have this one where you enter the output:
include "../Funciones/Conexion.php";
$mysqli = inicio();
$nombre = $_POST["nombre"];
$email = $_POST["email"];
$fecha = date('d/m/y');
$horaS = date('H:i:s');
$sql = "INSERT INTO chequeo (nombre,email,fecha,horaS)
VALUES ('$nombre','$email','$fecha','$horaS');";
$query = mysqli_query($mysqli,$sql);
if ($query){
echo "<script>alert(\"Exito al registrar.\"); </script>";
echo "<script>location.href='../Usuario.php'</script>";
} else {
echo "<script>alert(\"Error al registrar\"); </script>";
echo "<script>location.href='../Usuario.php'</script>";
}
What I need is that my query be like this:
|----|--------|----------------|------------|----------------|---------------|---------------------------|----------------|
| Id | Nombre | E-mail | Fecha | Hora de Entrada| Hora de Comida| Hora de Regreso de Comida | Hora de Salida |
|----|--------|----------------|------------|----------------|---------------|---------------------------|----------------|
| 28 | Carlos | Carlos90@gmail | 2008-07-17 | 00:37:42 | 00:00:00 | 00:00:00 | 00:40:20 |
|----|--------|----------------|------------|----------------|---------------|---------------------------|----------------|
<?php
$consulta= "SELECT * FROM chequeo WHERE nombre='".$_SESSION["nombre"]."'";
if ($resultado = $mysqli->query($consulta))
{
while ($fila = $resultado->fetch_row())
{
echo "<tr>";
echo "<td>$fila[0]</td><td>$fila[1]</td><td>$fila[2]</td><td>$fila[3]</td><td>$fila[4]</td><td>$fila[5]</td><td style='text-align: center;'>$fila[6]</td><td>$fila[7]</td><td>$fila[8]</td><td>$fila[9]</td>";
echo"<td>";
echo "</td>";
echo "</tr>";
}
$resultado->close();
}
$mysqli->close();
?>