作者:袁冠和堂 | 来源:互联网 | 2018-03-23 16:05
php代码:
mysqli = new mysqli($this->dbhost, $this->dbuser, $this->dbpassword, $this->dbname, $this->dbport);
if($this->mysqli->connect_error){
die('Connect Error ('.$this->mysqli->connect_errno.')'.$this->mysqli->connect_error);
}
}
//执行 dml 操作语句
function dml($sql){
$this->query = $this->mysqli->query($sql);
}
//取得受影响的行数
function affected_rows(){
$this->aff_rows = $this->mysqli->affected_rows;
}
//执行 dql 语句
function dql($sql){
$this->result = $this->mysqli->query($sql);
}
//取得查询结果条数
function num_rows(){
$this->num_rows = $this->result->num_rows;
}
//取得查询结果集
function fetch_object(){
//以对象形式返回
return $obj = $this->result->fetch_object();
}
}
?>