Файл: system/classes/DB.php
Строк: 40
<?php
Class DB {
public $db= NULL;
static $count_z=0;
public function __construct()
{
require_once(R.'/system/db_config.php');
$this->db=new mysqli(server, user, pass, db);
if($this->db->connect_errno)
{
error('Ошибка ( '.$this->db->connect_errno.' ) '.$this->connect_error);
exit();
}
$this->db->set_charset('utf8');
}
public function query($var)
{
$query=$this->db->query($var);
self::$count_z++;
return $query;
}
public function escape($var)
{
return $this->db->real_escape_string(trim($var));
}
public function guard($var)
{
return self::escape(htmlspecialchars(trim($var)));
}
public function insert_id()
{
return $this->db->insert_id;
}
public function fass($var)
{
$result=$this->query($var)->fetch_assoc();
return $result;
}
public function n_r($var)
{
return $this->query($var)->num_rows;
}
}
?>