【文件属性】:
文件名称:mysql的完整数据库连接PHP类库
文件大小:4KB
文件格式:ZIP
更新时间:2020-06-23 10:16:31
经典类库
简介:db_host = $db_host;
$this->db_user = $db_user;
$this->db_pwd = $db_pwd;
$this->db_database = $db_database;
$this->conn = $conn;
$this->coding = $coding;
$this->connect();
}
/*数据库连接*/
public function connect() {
if ($this->conn == "pconn") {
//永久链接
$this->conn = mysql_pconnect($this->db_host, $this->db_user, $this->db_pwd);
} else {
//即使链接
$this->conn = mysql_connect($this->db_host, $this->db_user, $this->db_pwd);
}
if (!mysql_select_db($this->db_database, $this->conn)) {
if ($this->show_error) {
$this->show_error("数据库不可用:", $this->db_database);
}
}private $db_host; //数据库主机private $db_user; //数据库用户名private $db_pwd; //数据库用户名密码private $db_database; //数据库名private $conn; //数据库连接标识;private $result; //执行query命令的结果资源标识private $sql; //sql执行语句private $row; //返回的条目数private $coding; //数据库编码,gbk,utf8,gb2312private $bulletin = true; //是否开启错误记录private $show_error = false; //测试阶段,显示所有错误,具有安全隐患,默认关闭private $is_error = false; //发现错误是否立即终止,默认true,建议不启用,因为当有问题时用户什么也看不到是很苦恼的
【文件预览】:
mysql的完整数据库连接PHP类库
----php中文网下载站.url(114B)
----mysql.php(11KB)