title: PHP Fatal error: Call to a member function query() on null
body: <p>I am new in php, and wonder why I getting this, need expert to guide.  Thanks.</p>
  
  <p>PHP Fatal error:  Call to a member function rowCount() on resource in C:\inetpub\wwwroot\xxx\xxx.php on line 9</p>
  
  <pre><code>&lt;?php
  include 'connect_db.php';
  $conn = null;
  
  $sqlGetFeedback = "Select * from t_abc";
  
  $resFB = $conn-&gt;query($sqlGetFeedback);
  $rows = array();
  
  if($resFB-&gt;rowCount()){
      echo json_encode($resFB-&gt;fetchAll(PDO::FETCH_ASSOC));
  } else {    
      echo '[{}]';
  }
  ?&gt;
  </code></pre>