I have the following code which does a check what I can not do is that when a user returns to check do not leave it if a record is already in a BD, I hope and someone can help me
<?php
include "../Funciones/Conexion.php";
$mysqli = inicio();
$nombre = $_POST["nombre"];
$fecha = date('Y-m-d');
$horaS = date('g:i:s');
$sql = "UPDATE chequeo
SET horaS = '$horaS'
WHERE fecha = '$fecha'";
$verificar_fecha = mysqli_query($mysqli, "SELECT * FROM chequeo WHERE horaS = '$horaS'");
if (mysqli_num_rows($verificar_fecha) > 0 ){
echo '<script>jQuery(function(){swal({
title:"Error",text:"Ya Checaste tu Dia De Salida, No Puedes Volver a Checar",type:"error",confirmButtonText:"Aceptar"
},function(){location.href="../Usuario.php";});});</script>';
exit;
}
$query = mysqli_query($mysqli,$sql);
if ($query){
echo '<script>jQuery(function(){swal({
title:"Exito",text:"Has Checado Con Exito",type:"success",confirmButtonText:"Aceptar"
},function(){location.href="../Usuario.php";});});</script>';
}else{
echo '<script>jQuery(function(){swal({
title:"Error",text:"Ocurrrio Un Error Al Checar",type:"error",confirmButtonText:"Aceptar"
},function(){location.href="../Usuario.php";});});</script>';
}
?>
PSD: change $ hourS = date ('g: i: s'); for $ hourS = time ('g: i: s'); Since I had been told that it works like that but it does not do it