它在数据库中找不到正确的电子邮件地址 [英] It cannot find the correct email address in the database

查看:208
本文介绍了它在数据库中找不到正确的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查有效的电子邮件地址,然后查看电子邮件地址是否在数据库中。目前,有效的电子邮件地址的验证工作正常。但是,如果我输入在数据库中的电子邮件地址,例如nickfrosty@yahoo.com,而不是回应您输入正确的电子邮件地址它回答完整的相反的消息和回复您在错误的电子邮件地址中输入。所以这使我认为它不能找到数据库中的电子邮件地址,即使我确定电子邮件地址是在数据库中。

I want to check for a valid email address and then see if the email address is in the database. At the moment the validation for a valid email address works fine. But if I enter in an email address which is in the database such as "nickfrosty@yahoo.com", instead of echoing the message You have entered in the Correct Email Address, it echos the complete opposite message and echos You entered in the Wrong Email Address. So this is making me think that it cannot find the email address in the database even though I am sure the email address is in the database.

所以我的问题是,为什么

So my question is that why can't it find the email address in the database and hence echos the message that I have entered in the wrong email address?

下面是代码(mysqli / php) :

Below is the code (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";
}


推荐答案

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

表示您检查 TeacherUsername TeacherEmail 。您可以尝试

means you check the input against TeacherUsername, not TeacherEmail. You might want to try

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

这篇关于它在数据库中找不到正确的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆