Журнал ошипотому чток
PHP Warning: mysqli::__construct(): (HY000/2002): Connection timed out in httpdocs/system/library/db/mysqli.php on line 7
PHP Warning: DB\MySQLi::__construct(): Couldn't fetch mysqli in httpdocs/system/library/db/mysqli.php on line 10
1 <?php
2 namespace DB;
3 final class MySQLi {
4 private $connection;
5
6 public function __construct($hostname, $username, $password, $database, $port = '3306') {
7 $this->connection = new \mysqli($hostname, $username, $password, $database, $port);
8
9 if ($this->connection->connect_error) {
10 throw new \Exception('Error: ' . $this->connection->error . '<br />Error No: ' . $this->connection->errno);
11 }
12
13 $this->connection->set_charset("utf8");
$this->connection->query("SET SQL_MODE = ''");
}