title: How to fetch results from a PDO prepare statement
body: <p>I am using a PDO prepare statement to select the result.</p>
  <p>My <em>index.php</em> file is:</p>
  <pre><code>include('operations.php');
  
  $userprofileobj = new operations();
  if(isset($_SESSION['user_email']))
  {
      $results = $userprofileobj-&gt;verify_user('account', $_SESSION['user_email'])-&gt;fetch(PDO::FETCH_ASSOC);
  
      echo $results['username'];
  }
  </code></pre>
  <p>My <em>operations.php</em> file is:</p>
  <pre><code>&lt;?php
      include('userclass.php');
  
      class operations extends userclass
      {
          public function verify_user($table_name, $user_email)
          {
              $stmt = $this-&gt;con-&gt;prepare(&quot;select * from &quot; . $table_name . &quot; where username = :user_email&quot;);
  
              $stmt-&gt;execute([
                  ':user_email' =&gt; $user_email,
              ]);
  
              return $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);
          }
      }
  </code></pre>
  <p>I am trying to match email and the result should be fetched in <em>index.php</em>. But I got an error:</p>
  <blockquote>
  <p>Fatal error: Call to a member function fetchColumn() on boolean in operations.php on line 84</p>
  </blockquote>