title: Made a login and registration with PHP, login says password not valid
body: <pre><code>&lt;?php
  require_once &quot;config.php&quot;;
  require_once &quot;session.php&quot;;
  $error = '';
  if ($_SERVER[&quot;REQUEST_METHOD&quot;] == &quot;POST&quot; &amp;&amp; isset($_POST['submit'])) {
      $email = trim($_POST['email']);
      $password = trim($_POST['password']);
      // validate if email is empty
      if (empty($email)) {
          $error .= '&lt;p class=&quot;error&quot;&gt;Please enter an email.&lt;/p&gt;';
      }
      // validate if password is empty
      if (empty($password)) {
          $error .= '&lt;p class=&quot;error&quot;&gt;Please enter your password.&lt;/p&gt;';
      }
      if (empty($error)) {
          if($query = $db-&gt;prepare(&quot;SELECT * FROM users WHERE email = ?&quot;)) {
              $query-&gt;bind_param('s', $email);
              $query-&gt;execute();
              $row = $query-&gt;fetch();
              if ($row) {
                  if (password_verify($password, isset($row['password']))) {
                      $_SESSION[&quot;userid&quot;] = $row['id'];
                      
                      // redirect the user to the welcome page
                      header(&quot;location: index.php&quot;);
                      exit;
                  } else {
                      $error .= '&lt;p class=&quot;error&quot;&gt;The password is not valid.&lt;/p&gt;';
                  }
              } else {
                  $error .= '&lt;p class=&quot;error&quot;&gt;No user exists by that email address.&lt;/p&gt;';
              }
          }
          $query-&gt;close();
      }
      // close connection
      mysqli_close($db);
  }
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Login&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css&quot;&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div class=&quot;container&quot;&gt;
              &lt;div class=&quot;row&quot;&gt;
                  
                 
                  &lt;form action=&quot;&quot; method=&quot;post&quot;&gt;
                     &lt;h2&gt;Login&lt;/h2&gt;
                       &lt;?php echo $error; ?&gt;
                         &lt;div class=&quot;form-group&quot;&gt;
                          &lt;label&gt;Email Address&lt;/label&gt;
                          &lt;input type=&quot;email&quot; name=&quot;email&quot; class=&quot;form-control&quot; required /&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                      &lt;label&gt;Password&lt;/label&gt;
                      &lt;input type=&quot;password&quot; name=&quot;password&quot; class=&quot;form-control&quot; required /&gt;
                      &lt;/div&gt;
                      &lt;div class=&quot;form-group&quot;&gt;
                      &lt;input type=&quot;submit&quot; name=&quot;submit&quot; class=&quot;btn btn-primary&quot; value=&quot;submit&quot;&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>I've had quite some errors like <code>if (password_verify($password, $row['password']))</code>
  said:</p>
  <blockquote>
  <p>Notice: Trying to access array offset on value of type bool in C:\xampp\htdocs\defgonnawork\login.php on line 22</p>
  </blockquote>
  <p>But I just threw a <code>isset</code> there
  database is properly connected, registration with the email and password was successful, I can see it saved in the db.</p>