ADODB mySQLi Connection

若如初见. 提交于 2020-01-04 02:04:27

问题


I am using mysql with adodb and what changes i have to do if i want to shift to mysqli.

this is my connection file and i need to make changes in this file only or i have to update all my query files.

include_once("adodblib/adodb.inc.php");
class ADb {
    function ADb()
    {
        global $dbserver;
        global $dbuser;
        global $dbpass;
        global $database;
    $dbuser = "root";
    $dbpass = "asdasdasd";
    $dbserver = "localhost";        
    $database = "DB_NAME";

        $this->conn1 = &ADONewConnection('mysql'); 
    $this->conn1->PConnect($dbserver, $dbuser, $dbpass, $database);
    }
    function query($sql){
        $Result = $this->conn1->Execute($sql);
        return $Result;
    }
    function ExecuteQuery($sql){
    $Result = $this->conn1->Execute($sql);
        return $Result;
    }
    function ExecuteQuery1($sql){
        return $this->query($sql);
    }
    function Execute($sql){
        return $this->query($sql);
    }
}

回答1:


You just need to change the parameter of ADONewConnection to mysqli.

Change the line

$this->conn1 = &ADONewConnection('mysql');

to

$this->conn1 = &ADONewConnection('mysqli');


来源:https://stackoverflow.com/questions/11839182/adodb-mysqli-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!