SQLSTATE[HY000] [2019] Unknown character set
Bonjour j'ai cette erreur qui s'affiche avec ce code pourriez vous m'aider ?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| <?php
class Dbconfig
{
private $host;
private $dbname;
private $dbuser;
private $dbpasswd;
/** @var PDO $maBaseConnection */
protected $maBaseConnection;
public function dbconnect()
{
$this->setdata();
//$db = new mysqli($this->host, $this->dbuser, $this->dbpasswd, $this->dbname);
try {
$this->maBaseConnection = new PDO('mysql:host=localhost;dbname=chat;charset=utf-8','root', '');
echo 'passe';
} catch (Exception $e) {
echo $e->getMessage();
}
}
public function getMaPDO()
{
return $this->maBaseConnection;
}
}
class GetData extends Dbconfig{
public function maFonction()
{
$response=null;
$this->dbconnect();
var_dump($this->maBaseConnection);
echo'test';
//$response=$this->maBaseConnection->query("SELECT * FROM users");
}
}
$d=new GetData();
$d->maFonction();
?>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html> |