title: PHP throwing invalid PHP Notice: Trying to get property of non-object
body: <p>I'm getting an error which seems to be happening incorrectly. </p>
  
  <p>I've got near enough the same function in a different class and it doesn't seem to happen.
  The function I'm using is:</p>
  
  <pre><code>public function UserInfo($type, $value) {
      if($type == 'email') {
         $query = $this-&gt;db-&gt;prepare("SELECT * FROM `accounts` where `provider` = '1' AND `email` = :value AND `type` = 'client' LIMIT 1");
      } else {
         $query = $this-&gt;db-&gt;prepare("SELECT * FROM `accounts` where `provider` = '2 'AND `prov_id` = :value AND `type` = 'client' LIMIT 1");
      }
  
      $params = array(":value" =&gt; $value,);
      $query-&gt;execute($params);
      return $query-&gt;FetchObject();
  }
  </code></pre>
  
  <p>And I'm trying to get the data via:</p>
  
  <p><code>$clients-&gt;UserInfo("id", $uid)-&gt;email;</code></p>
  
  <p>PHP returns the value, so its clear that the object does in fact exist, yet it still throws </p>
  
  <p><code>PHP Notice:  Trying to get property of non-object in /Users/Luke/public_html/manage.php on line 30</code></p>
  
  <p>Is there an issue with the syntax I'm using, or is it a PHP bug?</p>