if I input an email that is not in the database, always the same alert with the alert if the email is in the database. What's wrong with my coding ?
I input email '[email protected]' and I enter the result instead 'Email Address can used' should 'Email Address Already in Use'.
<html> <head> <!-- sweet alert --> <link rel="stylesheet" type="text/css" href="css/sweetalert.css"> <script type="text/javascript" src="js/sweetalert.min.js"></script> <!-- end sweet alert --> <script type="text/javascript"> $(document).ready(function(){ $('#email').blur(function(){ var email = $(this).val(); $.ajax({ type : 'POST', url : 'check-email.php', data : 'email='+email, success : function(data){ if(data==0) { swal({ title: "Email Address can used", text: "", type: "success" }); } else { swal({ title: "Email Address Already in Use", text: "", type: "warning" }); } }, }); }); }); </script> </head> <body> <form class="form-horizontal" method="POST" name="form"> <input type="email" name="email" id="email" class="form-control" required> </form> </body> </html> check-email.php
<?php include 'libraries/config.php'; $email = $_POST['email']; $cekdata=mysqli_query($conn,"SELECT * FROM user_csr WHERE email = '$email'"); ?> 

console.log(data)?