<?php
session_start();
include "../conexion.php";
$serial=$_POST["serial"]; 
$art_id=$_POST["art_id"]; 

$query=mysqli_query($con,"SELECT * from seriales_articulos where se_codigo ='$serial' and articulos_art_id='$art_id' ") or die(mysqli_error($con));
$result=mysqli_num_rows($query);
if($result == 0)
{
    $ser=mysqli_query($con, "INSERT INTO seriales_articulos (se_codigo,estado,articulos_art_id) 
            VALUES ('$serial','sin vender','$art_id')");
            
    echo '<div class="alert alert-success alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <strong>Serial!</strong> Registrado correctamente.
        </div>'; 
?>
    <script type="text/javascript">
        $('#modal_serial_nuevo').modal('hide');
        loadserial();
    </script>
<?php 
}
else
{
    echo '<div class="alert alert-danger alert-dismissable">
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
          <strong>Serial !</strong><strong> Ya Existe.</strong>
        </div>'; 
}
?>  