Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by crios ( 19 years ago )
function __construct($host, $user, $passwd, $db) {
$this->host = $host;
$this->user = $user;
$this->passwd = $passwd;
$this->db = $db;
}
/* Соединение с БД*/
function connect(){
$this->linkid = mysql_connect($this->host,$this->user,$this->passwd);
mysql_select_db($this->db);
}
/* Выполняет запрос к базе */
function query(){
try{
$this->result = @mysql_query($this->req, $this->linkid);
if(! $this->result)
throw new Exception("Ошибка запроса.");
}
catch (Exception $e){
echo $e->getMessage();
}
$this->querycount++;
return $this->result;
}
function fetchObject(){
$row = mysql_fetch_object($this->result);
return $row;
}

 

Revise this Paste

Your Name: Code Language: