问题
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