Unexpected '$this' (T_VARIABLE)
Midix021
Messages postés
1
Statut
Membre
-
jordane45 Messages postés 40051 Date d'inscription Statut Modérateur Dernière intervention -
jordane45 Messages postés 40051 Date d'inscription Statut Modérateur Dernière intervention -
<?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);
}
}
A voir également:
- Unexpected '$this' (T_VARIABLE)
- Hijack this - Télécharger - Antivirus & Antimalwares
- Cannot display this video mode - Forum Ecran
- No compatible source was found for this media - Forum Mozilla Firefox
- This is the mail system at host ✓ - Forum Mail
- This program cannot be run in dos mode ✓ - Forum Programmation
2 réponses
Bonjour,
En plus du point-virgule manquant .. tu as aussi des $ en trop.
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();
}