title: PHP login scripts prompts failure upon running
body: <p>I am trying to create a MySQLi login script with PHP that would connect to my SQL database and would authenticate the user with a session variable upon giving a username/email and password. I am using the following script but it prompts failure on every try.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Logging you in... | Project Club&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;?php
              if (session_status() == PHP_SESSION_NONE) {
                  session_start();
              }
              $servername = "censored";
              $serverusername = "censored";
              $serverpassword = "censored";
              $serverdbname = "censored";
              $usernamemail = $_POST["usernamemail"];
              $password = $_POST["password"];
              $conn = new mysqli($servername, $serverusername, $serverpassword, $serverdbname);
              if (isset($_POST["username"]) and isset($_POST["password"])) {
                  $sql = "SELECT * FROM login WHERE username='$usernamemail' OR email='$usernamemail';";
                  $result = mysqli_query($conn, $sql);
                  if ($row = mysqli_fetch_assoc($result)) {
                      $hashpwdcheck = password_verify($password, $row["password"]);
                      echo $hashpwdcheck;
                      if ($hashpwdcheck == true) {
                          $_SESSION["username"] = $row["username"];
                          echo "&lt;p&gt;You are successfully logged in.&lt;/p&gt;";
                      } else {
                          echo "&lt;p&gt;Invalid login credentials.&lt;/p&gt;";
                      }
                  }
                  mysqli_close($conn);
              } else {
                  echo "&lt;p&gt;Invalid login credentials.&lt;/p&gt;";
              }
          ?&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>