本文章为你免费提供一款漂亮的超简单php mysql数据库查询类哦
host=$host; //初始化主机名称
$this->root=$root; //初始化数据库帐号
$this->password=$password; //初始化数据库密码
$this->datebase=$datebase; //初始化数据库名称
$this->conn(); //初始化连接数据库的方法
$this->ut=$ut; //初始化编码
}
//常用连接数据库的方法
function conn(){
$conn = mysql教程_connect($this->host,$this->root,$this->password) or die ($this->error());
mysql_select_db($this->datebase,$conn) or die (没有这个数据库:.$this->datebase);
mysql_query(set names '$this->ut');
}
//常用传送sql到数据库的方法
function query($v){
return mysql_query($v);
}
//常用函数查看数据
function fetch_row($query){
return mysql_fetch_row($query);
}
//常用错误的方法
function error(){
return mysql_error();
}
//常用关闭数据库的方法
function close(){
return mysql_close();
}
}
?>