本文介绍了如何在php 5.3版本上将mysql类更改为mssql类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我们使用了mysql。但现在客户想要使用mssql。我搜索,我们使用PDO或sqlsrv类。但我不能决定哪个适合我们的项目或轻松更改此Web应用程序的结构?



我的代码示例



in my project, we used mysql. But now customer want to use mssql. i search, we use PDO or sqlsrv classes. But i can t decide which is suitable for our project or easily change this web application's structure?

my code example

class sql  {

public $oci;
public $rs;
public $temp;

public function __construct() {

    $this->oci = new mysqli(DBHOST, DBUSER, DBPASS,DBNAME);
    $this->oci->set_charset('utf8');

    if (mysqli_connect_errno()) {

           printf('Sql baglantı sorunu. Hata Kodu :' . mysqli_connect_errno());

           exit();
    }
}


public function closeOCI() {

    $this->oci->close();
}

public function query($query) {

    $this->rs = $this->oci->query($query);
}





和登录类扩展sql类





and login class extends sql class

    class login extends sql {


        public function loginControl($user, $pass)
        {

          $dbHandle = new sql($dbhost, $dbUserName, $dbPassWord, $dbCntDBName);
          //echo "SELECT level, name FROM users WHERE uName='$user' and pWord='$pass' limit 0,1";
          $dbHandle->query("SELECT level, name FROM users WHERE uName='$user' and pWord='$pass' limit 0,1");
          $result = $dbHandle->rs->fetch_assoc();

        return $result;
        }
}





我可以使用或轻松更改哪些驱动程序? thanx advice



which driver i can use or easily change them? thanx advice

推荐答案




这篇关于如何在php 5.3版本上将mysql类更改为mssql类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 00:32