I simply can't figure out why this short section of PHP code isn't working for me?.
following is my code to check for existing emails in database. the if statement not working and it goes directly to else condition.
PHP
<?php
$B=$_POST['email1'];
$conn = mysqli_connect("localhost", "root", "", "imart");
$sql = "
SELECT * FROM logintable
WHERE email = '".$_POST["email1"]."'
AND password = '".$_POST["password1"]."'
";
$res=mysqli_query($conn,$sql);
if (mysqli_num_rows($res) > 0) {
// output data of each row
$row = mysqli_fetch_assoc($res);
if($B==$row['email'])
{
echo "Exist";
}
}
else{ }
?>
Aucun commentaire:
Enregistrer un commentaire