title: Fatal error: Cannot access empty property
body: <p>i have got that error and the line was this :</p>
  
  <pre><code>   $stations=$this-&gt;$db-&gt;query('SELECT * from service_stations');
  </code></pre>
  
  <p>the $db variable is declared private and i use it in the __construct function like this:</p>
  
  <pre><code>public function __construct() {
                      //after including the config file
                  $host=DB_HOST;
              $dbname=DB_NAME;
              $dbuser=DB_USER;
              $dbpsw=DB_PASSWORD;
           try{
              $pdo_options[PDO::ATTR_ERRMODE]=PDO::ERRMODE_EXCEPTION;
              $this-&gt;db=new PDO('mysql:host='.$host.';dbname='.$dbname, $dbuser, $dbpsw, $pdo_options);
              }
           catch(Exception $e)
              {
              die('Erreur: '.$e-&gt;getMessage());
              }
      }
  </code></pre>
  
  <p>thx in advance :)</p>