Using if function in PHP and banning Emails
Question:
I have a table called blocked
in which, i store many Emails which are blocked
I want to use an if function, which states if the user is blocked or not
So, the user submits his Email from a Form field called Email
I did...
$BlockedEmail=$r[Emails]; ///Colomb name in database
if ($Email=='???'){
print "Sorry, your Email has been blocked"
}else{
print "Welcome";
In the place where i put ???? i dont know what to do
I want to say, if the Email is any of the blocked Emails in the database, then, print Sorry
Answers:
What about querying the database table and find if the email in blocked list?
It may be some thing like
$query="select * from block where email='useremail'"
$result=mysql_query($query);
if(mysql_num_rows($result)>0){
echo " Sorry you are blocked!";
}else{
echo "Welcome";
}
I have a table called blocked
in which, i store many Emails which are blocked
I want to use an if function, which states if the user is blocked or not
So, the user submits his Email from a Form field called Email
I did...
$BlockedEmail=$r[Emails]; ///Colomb name in database
if ($Email=='???'){
print "Sorry, your Email has been blocked"
}else{
print "Welcome";
In the place where i put ???? i dont know what to do
I want to say, if the Email is any of the blocked Emails in the database, then, print Sorry
Answers:
What about querying the database table and find if the email in blocked list?
It may be some thing like
$query="select * from block where email='useremail'"
$result=mysql_query($query);
if(mysql_num_rows($result)>0){
echo " Sorry you are blocked!";
}else{
echo "Welcome";
}
Commentaires
Enregistrer un commentaire