当我运行此代码时,它总是进入else块。 if条件或插入查询有什么问题?
<?php
require 'foodconfiguration.php';
$name="Ankita Mukreji";
$email="xyz@gmail.com";
$password="ankita1234";
$contact="9820213123";
$sqlquery="select * from users where email LIKE '$email'";
$result=mysqli_query($connection,$sqlquery);
if(mysqli_num_rows($result)==0){
$sqlinsertquery="insert into users (name,password,contact,email) values ('$name','$password','$contact','$email')";
$insertresult=mysqli_query($connection,$sqlinsertquery);
if($insertresult){
echo "Registration Successful\n";
}
else
{
echo mysqli_error();
}
}
else
{
echo "Email already Exists\n";
}
?>
答案 0 :(得分:0)
非常感谢@nospor,@ Mark飞利浦和其他人。