Compare A Record With Another Record From Another Table PHP

0

That such a community, could help me with this problem that I have, I do not have much knowledge, my problem is that I need to compare a record of a table called "Companies" in which it keeps both latitude and latitude and I need to compare it in a record that is done by doing a check which is saved in a table called "Check" in which I keep the same longitude and latitude, what I need is to compare if the records match, if it does not leave it check I hope and help

<?php

include "../Funciones/Conexion.php";
$mysqli = inicio();

$nombre = $_POST["nombre"];
$fecha = date('Y-m-d');  
$hora = date('g:i:s');
$latitud = $_POST["latitud"];
$longitud = $_POST["longitud"];


$sql = "INSERT INTO chequeo
(nombre,fecha,hora,latitud,longitud)
VALUES ('$nombre','$fecha','$hora','$latitud','$longitud')";



$verificar_fecha = mysqli_query($mysqli, "SELECT * FROM chequeo WHERE fecha = '$fecha' AND nombre='$nombre'");
if (mysqli_num_rows($verificar_fecha) > 0 ){
	echo '<script>jQuery(function(){swal({
                title:"Ya Has Checado Esto.!",
                text: "Sigue Trabajando Usuario",
                type:"error"
          },function(isConfirm){
           	 window.location.href = "../Usuario.php";  
          });
          $(".swal2-confirm").click(function(){
                window.location.href = "../Usuario.php";
          });});</script>';
	exit;
}
$query = mysqli_query($mysqli,$sql);
if ($query){
echo '<script>jQuery(function(){swal({
                title:"Chequeo Con Exito.!",
                text: "Bienvenido al Trabajo.!",
                type:"success"
          },function(isConfirm){
           	 window.location.href = "../Usuario.php";  
          });
          $(".swal2-confirm").click(function(){
                window.location.href = "../Usuario.php";
          });});</script>';
}else{
echo '<script>jQuery(function(){swal({
                title:"Upss.!",
                text: "Ocurrio un error, comunicate con tu Administrador",
                type:"error"
          },function(isConfirm){
           	 window.location.href = "../Usuario.php";  
          });
          $(".swal2-confirm").click(function(){
                window.location.href = "../Usuario.php";
          });});</script>';
}
?>

    
asked by iBokii 07.09.2017 в 18:20
source

0 answers