title: PHP OOP extending class can't access database connection
body: <p>Perhaps you can help. I have a main class that creates a MySql connection. Then I extend this class. I wasn't able to access the connection unless I did a  parent::__construct(); and recently while doing this I got an error message that I was out of connections.</p>
  
  <p>So how do program this so it doesn't run out of connections and can access the database connection.</p>
  
  <pre><code>class Common 
  {
      var $mysql;
  
      function __construct()
      {   
          $this-&gt;mysql=new mysqli($this-&gt;dbHOST, $this-&gt;dbUSERNAME, $this-&gt;dbPASSWORD, $this-&gt;dbNAME);
      }
  }
  
  class Role extends Common {
  
      function __construct()
      {
          parent::__construct();
      }
  }
  </code></pre>