PHP头条
热点:

一个功能还算完整的数据库操作类


 

  1. <?php    
  2. /*   
  3. *   Author  墨龙   
  4. *   Time    2010年12月2日 15:50:35    
  5. */    
  6.     
  7. $db = new mysql($db_host,$db_user,$db_password,$db_table,$db_conn,$pre,$coding);    
  8.     
  9. class mysql{    
  10.         
  11.     private    $db_host;    
  12.     private    $db_user;    
  13.     private    $db_password;    
  14.     private    $db_table;    
  15.     private    $db_conn;           //数据库连接标识;    
  16.     private    $result;         //执行query命令的结果资源标识    
  17.     private    $sql;      //sql执行语句    
  18.     private    $pre;      //数据库表前缀      
  19.     private    $coding;  //数据库编码,GBK,UTF8,gb2312    
  20.         
  21.         
  22.     function __construct($db_host,$db_user,$db_password,$db_table,$db_conn,$pre,$coding){    
  23.             
  24.         $this->db_host     = $db_host;    
  25.         $this->db_user     = $db_user;    
  26.         $this->db_password = $db_password;    
  27.         $this->db_table    = $db_table;    
  28.         $this->db_conn     = $db_conn;    
  29.         $this->pre         = $pre;    
  30.         $this->coding      = $coding;    
  31.         $this->connect();    
  32.         
  33.     }    
  34.         
  35.     function connect(){    
  36.             
  37.         $this->db_conn = @mysql_connect($this->db_host,$this->db_user,$this->db_password) or die($this->show_error("数据库链接错误,请检查数据库链接配置!"));    
  38.         if(!mysql_select_db($this->db_table,$this->db_conn)){    
  39.                 
  40.             echo "没有找到数据表:".$this->db_table;    
  41.         }    
  42.         mysql_select_db($this->db_t

    www.phpzy.comtrue/phprm/23467.htmlTechArticle一个功能还算完整的数据库操作类 ?php /* *Author墨龙 *Time2010年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_...

相关文章

    暂无相关文章

PHP之友评论

今天推荐