title: PDO extend for a crud querys and Fatal error
body: <p>I'm trying to make a query class for a CRUD and want extend the connection from other class, but i get a error : Fatal error: Call to a member function prepare() on a non-object !?
  What i miss ? Or is it just stupito to extend it ?</p>
  
  <p>Here my MYsql_connection what extend to Querys class. Both are different php files.</p>
  
  <pre><code>class Mysql_connection extends Querys
  {
  
      protected $dbh = null;
  
          function __construct()
          {
                  try
                  {
                      $this-&gt;dbh = new PDO('mysql:host=host; dbname=db','user','pass', array(PDO::MYSQL_ATTR_INIT_COMMAND=&gt; 'SET NAMES utf8'));
                      $this-&gt;dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                      $this-&gt;dbh-&gt;setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
  
                  }
                  catch(PDOException $e)
                  {
                      $this-&gt;dbh = null; 
                      print('Error on connection'.$e-&gt;getMessage());
                      die();
                  }
          }
  }
  </code></pre>
  
  <p>And here is a Query class</p>
  
  <pre><code>class Querys{
  
      function getData()
      {
          $sql = "SELECT * FROM db";
  
          $result = $dbh-&gt;prepare($sql);
  
          $result = execute();
  
          $data = $result-&gt;fetch(PDO::FETCH_ASSOC);
  
                      return = $data;
      }
  
  }
  </code></pre>