title: PDO rowCount() error when calling its object from extended classes
body: <p>I have a database class that I made that uses PDO to connect to my queries, I'm calling it in my main classes constructor as an object.</p>
  
  <pre><code>class MyClass
  {
      protected $db;
  
      public __constructor()
      {
          $this-&gt;db = new Database();
      }
  }
  class Themes extends MyClass
  {
      public $avatar;
      public $theme_name;
      public $theme_by;
      public $theme_by_email;
      public $theme_by_website;
      public $theme_description;
      public $theme_thumb;
      public $theme_source;
      public $theme_css;
      public $theme_js;
      public $theme_uploaded_on;
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;get_theme();
          $this-&gt;get_avatar();
      }
  
      public function get_theme()
      {
          $sql = "SELECT *
                  FROM `user_themes`
                  WHERE `user_id` = " . $this-&gt;session-&gt;get('user_id');
          if($this-&gt;db-&gt;row_count($sql))
          {
              $result                  = $this-&gt;db-&gt;fetch_row_assoc($sql);
              $this-&gt;theme_name        = $result['theme_name'];
              $this-&gt;theme_by          = $result['theme_by'];
              $this-&gt;theme_by_email    = $result['theme_by_email'];
              $this-&gt;theme_by_website  = $result['theme_by_website'];
              $this-&gt;theme_description = $result['theme_description'];
              $this-&gt;theme_source      = $result['theme_source'];
              $this-&gt;theme_css         = $result['theme_css'];
              $this-&gt;theme_js          = $result['theme_js'];
              $this-&gt;theme_uploaded_on = $result['theme_uploaded_on'];
          }else{
              die('no results');
          }
      }
  }
  </code></pre>
  
  <p>My problem is that if I include my extended classes that calls the constructor of MyClass then I get this error:</p>
  
  <pre><code>Fatal error: Call to a member function rowCount() on a non-object in db.class.php on line 98
  </code></pre>
  
  <p>which points to this line in my db.class.php</p>
  
  <pre><code>class Database {
  
      private static $PDO;
      private static $config;
  
      public function __construct() {
  
          if (!extension_loaded('pdo'))
              die('The PDO extension is required.');
  
          self::$config = config_load('database');
  
          self::connect();
  
      }
  ...
      public function row_count($statement)
      {
          return self::$PDO-&gt;query($statement)-&gt;rowCount(); //Line 98
      }
  }
  </code></pre>
  
  <p>If I comment out parent::__construct() from my extended classes then I'm ok and get no errors.</p>
  
  <p>Try my site in FireFox, Chrom, Opera, and Safari</p>
  
  <p><a href="http://www.helixagent.com" rel="nofollow">http://www.helixagent.com</a></p>
  
  <p>I seem to be ok in Firefox 3.6 but all those other browsers throw me the error I mentioned...</p>