3

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);
    }
}
Huzoor Bux
  • 1,026
  • 4
  • 20
  • 46

1 Answers1

2

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

Change the line

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

to

$this->conn1 = &ADONewConnection('mysqli');
Jatinder Kumar
  • 503
  • 6
  • 17