Help!!!!
Here is the script I am having trouble with:
/ see if Email address given is already in the database /
trim($UsrEmail);
$query = "select from person where Email = '$UsrEmail'";
/ Need to add and PersonType = 'U' back in /
$result2 = mysql_query($query);
$num= mysql_num_rows($result2);
/ Close the database connection */
MYSQL_CLOSE();
if ($result2 != 0)
{$i=0;
while ($i < $num)
{
$UserEmail=mysql_result($result2,$i,"Email");
$UserFirst = mysql_result($result2,$i,"FirstName");
$UserLast = mysql_result($result2,$i,"LastName");
$UserID = mysql_result($result2,$i,"PersonID");
++$i;
}
$result2 = 0;
header("Location: ExistingUser.php");
exit;
}
else
{ trim($FirstName);
$UserFirst = $FirstName;
trim($LastName);
$UserLast = $LastName;
trim($UsrEmail);
$UserEmail = $UsrEmail;
header("Location: NewUserFeedbackOption.php");
exit;
}
I am sending 4 variables from an HTML form called $FirstName, $LastName, $EmailVerify and $UsrEmail.
This was working when I only entered new email addresses I knew were not in the database. I tried entering one I knew was in the database and was sent to the existing user page, all good. But when I tried to enter another email I knew was not in the database I ended up on the ExistingUser page, Doh. Now any email address I send (even if I leave email blank) sends me to the existing user page. I've tried emptying my browser cache, deleting all session info, shutting down the browser and shuting down the computer. There always seems to be a non 0 value in $result2.
Anyone???
Thanks