I am making this password recovery script and everything works unless the name typed in is not in the database, the error message wont execute, which is an "else" after an if, if the count is not one(which means there is a name in the db there).
if(isset($login_name)){
require("include_scripts/db_mem_login.php");
//Check for matching name and password
$Result = mysql_query("SELECT count(*) from $TableName where login_name='$login_name'")or die(mysql_error());
$count=mysql_result($Result,0,0)or die(mysql_error());
if($count>0)
{
$Result = mysql_query("SELECT email, login_name, login_password from $TableName where login_name='$login_name'")or die(mysql_error());
$row = mysql_fetch_array ($Result)or die(mysql_error());
$headers = "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: Password Recovery <AutoEmailer_DoNotReply@noreply.com>\r\n";
$subject = "Password Recovery Request For $login_name";
$text = "text here";
if(mail($row["email"], $subject, $text, $headers)){
echo'<center>Thank you, your password has been sent to the e-mail linked to your account</center>';
}else{
echo'<center>There was an error when processing the mail request, please resubmit that form.</center>';
}
//|||||||||||||||||||||||||||||
//THIS IS WHERE IT SHOULD BE EXECUTING WHEN I TYPE SOMETHING IN WRONG BUT ITS NOT
}else{
echo'<center>I am sorry but that user name is not in our database, check to make sure it was correct.<br>
If you have further problems ask for help from an administrator in the message board.</center>';
}
//|||||||||||||||||||||||||||
}
It works when I type in a correct name but when its incorrect I get nothing. It should be printing out that error echo and I don't see why its not, any help would be great, thanks for your time.