So I'm saving user's ranks into a SQL database as enumerators. I then want to try and check their rank and compare it to a string. If the rank is equal to the string then I want to allow them access. Here is my code so far (Which doesn't work):
$email = stripslashes($email);
$password = stripslashes($password);
$email = mysql_real_escape_string($email);
$password = mysql_real_escape_string($password);
$sql = "SELECT RANK FROM $table WHERE EMAIL = '$email' and PASSWORD = '$password'";
$result = mysql_query($sql);
$count = mysql_num_rows($result);
if($count == 1){
if($result == "OWNER") {
header("location: panel.php");
} else {
$message = "Permission denied.";
}
} else {
$message = "Incorrect email or password.";
}