求PHP与MySql和SqlServer数据库连接的类的实例。也可以发到在下的邮箱里:[email protected]
小弟在此先行谢过,万分感激。

解决方案 »

  1.   

    我收藏的一个类,你可以看看
    http://blog.csdn.net/hopestar2/archive/2010/11/18/6019984.aspx
      

  2.   

    这个,看了楼上兄弟收藏的类,还不错的说。
    之前看过一些高手写的SQL类,那叫觉啊看的我直接很晕。目前还不敢用,因为还没研究透。
      

  3.   

    http://blog.csdn.net/hopestar2/archive/2010/11/18/6019984.aspx
      

  4.   

    class MySQL {    private function __construct($server,$user,$pwd,$charset,$dbname){           $this->connect($server,$user,$pwd,$charset);
       $this->selectdb($dbname);
       }    //实例化数据库对象
       public static function getDB($server,$user,$pwd,$charset,$dbname){
            
    $db = new MySQL($server,$user,$pwd,$charset,$dbname);
    return $db;
       }
           
       //连接数据库标识
       private $conn;
           
       //连接服务器
       public function connect($server,$user,$pwd,$charset){
       
            $this->conn=mysql_connect($server,$user,$pwd);
    mysql_query("SET character_set_connection=gb2312,character_set_results=$charset,character_set_client=binary",$this->conn);
    if($this->conn==false){
      
      echo "<center>连接服务器失败!<br />请刷新后重新连接!</center>";
      die($this->conn);
    }
       }
           
       //选择数据库
       public function selectdb($dbname){
         
         $con=mysql_select_db($dbname,$this->conn);
     if($con==false){
       
       echo "<center>选择数据库!<br />请刷新后重新连接!</center>";
       die($con);
     }
       }
    }
      

  5.   

    adodb5,楼主查一下,很好用的,功能很强大