I want to connect to my database using pdo , but in php version 5.5 and php7 not work. This is my code,
public static function getInstance() {
if (!isset(self::$instance)) {
try {
// $charset = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8");
self::$instance = new PDO(DNS, USER, PASSWORD, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
// self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
echo'connexion reussie';
} catch (Exception $e) {
echo "failed to connect : ", $e->getMessage();
die();
}
}
return self::$instance;
}
how I can modify this code to be working with php 5.5 and php 7.
Thanks for helps