title: Fatal PDO Error: Cannot use object of type PDOStatement as array in
body: <p>I'm getting an fatal error trying to run this, and I can't figure out why. The error is:</p>
  
  <p>Fatal error: Cannot use object of type PDOStatement as array in C:\xxx.php on line 22</p>
  
  <p>Line 22 is the line</p>
  
  <pre><code>if($resultaat['poop'] == 0){
  </code></pre>
  
  <p>Here is the full code</p>
  
  <pre><code>if ($db &lt;&gt; NULL) {
  
  
          $sql = "SELECT COUNT(leerlingen.bestemming) AS someVar FROM leerlingen, bestemmingen 
          WHERE leerlingen.bestemming = (SELECT bestemming FROM bestemmingen WHERE bestemmingsnummer =  $_GET[bestemmingsnummer]) ";
          $resultaat = $db-&gt;query($sql);
  
  
          if($resultaat['someVar'] == 0){
  
              echo '&lt;script type="text/javascript"&gt;'; 
              echo 'alert("true.")'; 
              echo '&lt;/script&gt;';
  //              $sql = "DELETE FROM bestemmingen WHERE bestemmingsnummer =      $_GET[bestemmingsnummer]";
  //              $resultaat = $db-&gt;exec($sql);
          }
          else{
              echo '&lt;script type="text/javascript"&gt;'; 
              echo 'alert("false")'; 
              echo '&lt;/script&gt;';  
          }
  
  }
  </code></pre>
  
  <p>Thanks in advance!</p>