title: Call to a member function fetchAll() on boolean
body: <p>I have the following problem.</p>
  
  <p>This error persisting in accompanying me</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to a member function fetchAll() on boolean in C:\xampp\htdocs\certificado\functions.php:49 Stack trace: #0 C:\xampp\htdocs\certificado\index.php(11): get_info_from_email('amanda_pandoka@...') #1 {main} thrown in C:\xampp\htdocs\certificado\functions.php on line 49</p>
  </blockquote>
  
  <p>In the code below I can not understand the error. Can someone help me?</p>
  
  <pre><code>    function connect() {
      $socket = new PDO('mysql:host=' . @$host . ';dbname=' . @$nomedobancodedados,
          @$usuario, @$senha);
      $socket-&gt;setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
      return $socket;
  }
  
  function get_info_from_email($email) {
  
      if (!$email)
          return false;
  
      global $db;
  
      $sql = "
          SELECT
              id,
              name,
              email,
              type,
              data,
              file
          FROM
              attendee
          WHERE 1=1
              AND email = '{$email}'
      ";
      if ($info = $db-&gt;query($sql))
          return false;
  
      if ($info = $info-&gt;fetchAll())
          return false;
  
      return $info;
  
      }
  </code></pre>