link = mssql_connect($config['hostname'], $config['username'], $config['password']);
if($this->link) return true;
$this->show_error(mssql_error($this->link), "connect()");
return false;
/*if($this->link) {
mysql_query("SET NAMES 'utf8'");
return true;
}
$this->show_error(mssql_error($this->link), "connect()");
return false;*/
}
function connect_manual($dbServer,$dbUser,$dbPass) {
$this->link = mssql_connect($dbServer,$dbUser,$dbPass);
if($this->link) {
mysql_query("SET NAMES 'utf8'");
return true;
}
$this->show_error(mssql_error($this->link), "connect()");
return false;
}
function selectdb($database) {
if($this->link) {
mssql_select_db($database, $this->link);
return true;
}
$this->show_error("Not connect the database before", "selectdb($database)");
return false;
}
function query($sql) {
$this->result = mssql_query($sql);
return $this->result;
}
function getnext() {
return mssql_fetch_object($this->result);
}
function num_rows() {
return mssql_num_rows($this->result);
}
function show_error($errmsg, $func) {
echo "" . $func . " : " . $errmsg . "
\n";
exit(1);
}
function Disconnect(){
return mssql_close($this->link);
}
}
?>