title: Fatal error: Call to undefined method PDO::fetch() in C:\wamp\www\FINAL login\memberpage.php on line 24
body: <p>Am really confused about this error
  i have done everything to solve this error but i cant do anything
  can someone help me</p>
  
  <p>am trying to display all value store in SQL database in php</p>
  
  <pre><code>    &lt;?php
  require('includes/config.php');
  //if not logged in redirect to login page
  if (!$user-&gt;is_logged_in()) {
      header('Location: login.php');
  }
  //define page title
  $title = 'Members Page';
  //include header template
  require('layout/header.php');
  ?&gt;
  &lt;div class="container"&gt;
      &lt;div class="row"&gt;
          &lt;div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3"&gt;
              &lt;h2&gt;Member only page - Welcome &lt;?php echo $_SESSION['username']; ?&gt;&lt;/h2&gt;
              &lt;p&gt;&lt;a href='logout.php'&gt;Logout&lt;/a&gt;&lt;/p&gt;
              &lt;hr&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;?php
      $result = $db-&gt;prepare("SELECT * FROM password");
      $result-&gt;execute();
  
      while ($row = $db-&gt;fetch(PDO::FETCH_ASSOC))
      {
      $title = $row['email'];
      $body = $row['pass'];
      }
      echo "&lt;table&gt;
      &lt;tr&gt;
      &lt;th&gt;Usernamw&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt; 
        &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;" . $title . "&lt;/td&gt;
      &lt;td&gt;" . $body . "&lt;/td&gt; 
    &lt;/tr&gt;
    &lt;/table&gt;" ?&gt;
  &lt;/div&gt;
  &lt;?php
  //include header template
  require('layout/footer.php');
  ?&gt;
  </code></pre>
  
  <p>this is were i get error </p>
  
  <pre><code>    while ($row = $db-&gt;fetch(PDO::FETCH_ASSOC))
  </code></pre>