Igori
Эксперт
Дата регистрации:
04.07.2011 21:09:44
Сообщений: 104
<?php
require_once ('class.param_db.php';
class Connect_DB
{
public $mysqli;
function __construct ($db_host, $db_name, $db_user, $db_pass)
{
$this->db_host = $db_host;
$this->db_name = $db_name;
$this->db_user = $db_user;
$this->db_pass = $db_pass;
}
function connect ($db_host, $db_name, $db_user, $db_pass)
{
$this->mysqli = new mysqli($this->db_host, $this->db_user, $this->db_pass) or die("соединение с сервером не установлено"
$this->mysqli->query($this->db_name) or die("база данных не выбрана"
$this->mysqli->query("SET NAMES 'cp1251'" or die("кодировка не установлена"
}
}
$db = new Connect_DB ($db_host, $db_name, $db_user, $db_pass);
$db->connect($db_host, $db_name, $db_user, $db_pass);
?>