I am not sure how to approach this. I want verify that a user exist with an email in MySQL database and then verify that the email address has a certain value like 1 in the active column before they have access to a page otherwise it throws a message. If that email is valid and has a value of 1 in the active column , then verify password and if all three passes, they have access to the page. I have attempted the lines with the --> but I am not sure if that is the best place to put the code there or not or if I am doing it right. I am using MYSQLI. 

---

```
$email = $mysqli->escape_string($_POST['email']);
$result = $mysqli->query("SELECT * FROM accounts WHERE email='$email'");

if ( $result->num_rows == 0 ){ // User doesn't exist
$_SESSION['message'] = "User with that email doesn't exist!";
header("location: error.php");
}

else {  //User exists
$user = $result->fetch_assoc();

--> //$Act = $mysqli->query("SELECT $email FROM accounts WHERE active='1'");

--> if ( !$_SESSION['active'] = 1 )
  {

    $_SESSION['message'] = "Your account has been activated and is being reviewed";
    header("location: error.php");

   }

else
if ( password_verify($_POST['password'], $user['password']) ) {

    $_SESSION['email'] = $user['email'];
    $_SESSION['first_name'] = $user['first_name'];
    $_SESSION['last_name'] = $user['last_name'];
    $_SESSION['active'] = $user['active'];

    // This is how we'll know the user is logged in
    $_SESSION['logged_in'] = true;

    header("location: https://somepage.php");
}
else {
    $_SESSION['message'] = "You have entered wrong password, try again!";
    header("location: error.php");
}
}
 }

```