You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
592 B
16 lines
592 B
<?php |
|
|
|
class Model { |
|
|
|
protected $db; |
|
|
|
public function __construct($database, $hostname, $port, $user, $password) { |
|
try { |
|
$this->db = new PDO('mysql:dbname=' . $database . ';host=' . $hostname . ';port=' . $port . ';charset=utf8', $user, $password, [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8']); |
|
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
$this->db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC); |
|
} catch(PDOException $e) { |
|
trigger_error($e->getMessage()); |
|
} |
|
} |
|
}
|
|
|