一个功能还算完整的数据库操作类
程序员文章站
2022-06-17 17:06:54
...
- /*
- * Author 墨龙
- * Time 2010年12月2日 15:50:35
- */
- $db = new mysql($db_host,$db_user,$db_password,$db_table,$db_conn,$pre,$coding);
- class mysql{
- private $db_host;
- private $db_user;
- private $db_password;
- private $db_table;
- private $db_conn; //数据库连接标识;
- private $result; //执行query命令的结果资源标识
- private $sql; //sql执行语句
- private $pre; //数据库表前缀
- private $coding; //数据库编码,GBK,UTF8,gb2312
- function __construct($db_host,$db_user,$db_password,$db_table,$db_conn,$pre,$coding){
- $this->db_host = $db_host;
- $this->db_user = $db_user;
- $this->db_password = $db_password;
- $this->db_table = $db_table;
- $this->db_conn = $db_conn;
- $this->pre = $pre;
- $this->coding = $coding;
- $this->connect();
- }
- function connect(){
- $this->db_conn = @mysql_connect($this->db_host,$this->db_user,$this->db_password) or die($this->show_error("数据库链接错误,请检查数据库链接配置!"));
- if(!mysql_select_db($this->db_table,$this->db_conn)){
- echo "没有找到数据表:".$this->db_table;
- }
- mysql_select_db($this->db_t
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。