Файл: system/classes/DataBase.php
Строк: 31
<?php
defined('ACCESS') or die('Error => Access');
class DataBase extends PDO {
private $db;
public static $Instance = NULL;
public static function Instance() {
if (self::$Instance == NULL) {
self::$Instance = new self();
}
return self::$Instance;
}
public function __construct() {
$OPTION = array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
);
$this->db = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASS, $OPTION);
}
public function prepare($sql, $values = null) {
$stm = $this->db->prepare($sql);
$stm->execute($values);
return $stm;
}
public function lastInsertId() {
$lastid = $this->db->lastInsertId();
return $lastid;
}
}