title: Database Connection Class constructor
body: <p>I'm just getting started with OOP PHP and all of the information out there is about a car that is red or blue...it's hard to get my head around the database connection only object as such.</p>
  <p>I have a haunting suspicion that my __construct() shouldn't have the connection string in it and instead be it's own method inside the class.. but it works so....</p>
  <p>Is it incorrect to define my connection class like below.. If it is wrong - how should it look?</p>
  <pre><code>class dbConnect {
  
      // Declare connection info for PDO
      private $dbType = 'mysql';
      private $dbHost = 'localhost';
      private $dbUser = 'user';
      private $dbPass = 'password';
      private $dbName = 'db';
      
      // Declare connection variable for object
      private $dbConn;
      
      // Construct object
      private function __construct() {
  
          // Create Database connection and assign it to object as dbConn
          $this -&gt; dbConn = new PDO( $this -&gt; dbType . ':' . 'host=' . $this -&gt; dbHost . ';' . 'dbname=' . $this -&gt; dbName , $this -&gt; dbUser , $this -&gt; dbPass );    
      } 
  } 
  </code></pre>