$id= $_POST["id"];

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link0 = mysqli_connect("localhost", "root", "P-11fl32fg14", "check-in");
$id_validation = preg_match('/[0-9]{8}-[A-Z]{1}/',$id);
if($id_validation) {
$query0 = "SELECT id FROM check-in WHERE id='$id'";


    if ($query0 == $id){
        echo "The entered id already exists, please enter another id";
    }
    mysqli_query($link0, $query0);
    mysqli_close($link0);
}

    Because you're just comparing the $id with the text of the query. You're sending the query to the database after you make the check, and then just throwing the result away.

    Write a Reply...