mirror of
https://gitlab.com/ruany/litebans-php.git
synced 2025-05-24 00:42:43 +00:00
More code to support ancient PHP versions
This commit is contained in:
parent
7cb40db874
commit
e06b02b67e
@ -108,10 +108,14 @@ final class Settings {
|
|||||||
$dsn .= ';charset=utf8';
|
$dsn .= ';charset=utf8';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$options = array(
|
||||||
|
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||||
|
PDO::ATTR_EMULATE_PREPARES => false,
|
||||||
|
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->conn = new PDO($dsn, $username, $password);
|
$this->conn = new PDO($dsn, $username, $password, $options);
|
||||||
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
||||||
$this->conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
Settings::handle_error($this, $e);
|
Settings::handle_error($this, $e);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user