Unexpected '$this' (T_VARIABLE) - Forum PHP

A voir également:Unexpected '$this' (t_variable)Syntax error, unexpected 'class' (t_class), expecting identifier (t_string) or variable (t_variable) or '{' or '$' - Conseils pratiques - PHP Unexpected kernel mode trap - Forum - Windows 10 Unexpected store exception ✓ - Forum - Windows Sorry, something went wrong. we're working on getting this fixed as soon as we can. ✓ - Forum - Facebook This kernel requires an x86-64 cpu but only detected an i686 cpu ✓ - Forum - Windows

<?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

A voir également:Unexpected '$this' (t_variable)Syntax error, unexpected 'class' (t_class), expecting identifier (t_string) or variable (t_variable) or '{' or '$' - Conseils pratiques - PHP Unexpected kernel mode trap - Forum - Windows 10 Unexpected store exception ✓ - Forum - Windows Sorry, something went wrong. we're working on getting this fixed as soon as we can. ✓ - Forum - Facebook This kernel requires an x86-64 cpu but only detected an i686 cpu ✓ - Forum - Windows

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