Unexpected '$this' (T_VARIABLE) - Forum PHP

Unexpected '$this' (T_VARIABLE) Goto was unexpected at this time » Forum - Disque dur / SSD Goto was unexpected at this time » Forum - Ordinateur portable Unexpected store exception (Résolu) » Forum - Windows This kernel requires an x86-64 cpu but only detected an i686 cpu (Résolu) » Forum - Windows Edit this cookie » Télécharger - Extensions

<?php   class bd{      private $hostname;     private $dbname;     private $username;     private $password;     private $option = array(                                 PDO::ATTR_PERSISTENT =>true ,                                 PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION                              );       protected $bdd;     public function __construct()    {     $ini = parse_ini_file('Parameter/paraBD.ini')     $this->$hostname = $ini['hostname'];     $this->$dbname = $ini['databaseName'];     $this->$username = $ini['username'];     $this->$password = $ini['password'];     connection();    }     public function connection()    {         $dsn = 'mysql:host='. $this->$hostname .';dbname='. $this->$dbname;         $this->$bdd = new PDO($dsn, $this->$username, $this->$password, $this->$option);      } }  

Forum

Unexpected '$this' (T_VARIABLE) Goto was unexpected at this time » Forum - Disque dur / SSD Goto was unexpected at this time » Forum - Ordinateur portable Unexpected store exception (Résolu) » Forum - Windows This kernel requires an x86-64 cpu but only detected an i686 cpu (Résolu) » Forum - Windows Edit this cookie » Télécharger - Extensions

Web: www.shapebootstrap.net

2 réponses

Marsh

NOVEMBER 9, 2013 AT 9:15 PM

; manquant

Reply

Marsh

NOVEMBER 9, 2013 AT 9:15 PM

Bonjour,

En plus du point-virgule manquant .. tu as aussi des $ en trop.

  public function __construct()    {     $ini = parse_ini_file('Parameter/paraBD.ini');     $this->hostname = $ini['hostname'];     $this->dbname = $ini['databaseName'];     $this->username = $ini['username'];     $this->password = $ini['password'];     connection();    } 

Reply

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed