它不能在数据库中找到正确的邮箱地址(It cannot find the correct email

2019-07-31 06:05发布

我要检查一个有效的电子邮件地址,然后看如果电子邮件地址是在数据库中。 目前一个有效的电子邮件地址,确认工作正常。 但是,如果我在这是在数据库中,如“nickfrosty@yahoo.com”,而不是呼应了消息的电子邮件地址,输入You have entered in the Correct Email Address ,它回声完全相反的消息,回声You entered in the Wrong Email Address 。 所以这个是让我觉得即使我敢肯定的电子邮件地址是在数据库中无法找到在数据库中的电子邮件地址。

所以我的问题是,为什么不能在数据库中找到的电子邮件地址,因此回声,我错了电子邮件地址已经进入了信息?

下面是代码(的mysqli / PHP):

if ( (strlen($email) >= 7) && (strstr($email, "@")) && (strstr($email, ".")) ){

echo "You have entered in the Correct Email Address";

}
else{
echo "You entered in the Wrong Email Address";
}

Answer 1:

$query = "SELECT TeacherUsername, TeacherEmail FROM Teacher WHERE TeacherUsername = ?";

意味着你核对输入TeacherUsername ,不TeacherEmail 。 你可能会想尝试

$query = "SELECT TeacherUsername, TeacherEmail FROM Teacher WHERE TeacherEmail = ?";


文章来源: It cannot find the correct email address in the database