Php 使用wamp服务器中的adodb连接到数据库
我尝试使用ADODB插件连接到WAMP服务器中的数据库,但无法连接,我的代码如下:Php 使用wamp服务器中的adodb连接到数据库,php,connection,wamp,adodb,Php,Connection,Wamp,Adodb,我尝试使用ADODB插件连接到WAMP服务器中的数据库,但无法连接,我的代码如下: $this->xml = NewADOConnection('mysql://root:@localhost/xml_tarpine'); $this->xml->SetFetchMode(ADODB_FETCH_ASSOC); $this->xml->Execute('SET NAMES "utf8"'); 问题在哪里 试试这个简单的课程 class AdoConnection
$this->xml = NewADOConnection('mysql://root:@localhost/xml_tarpine');
$this->xml->SetFetchMode(ADODB_FETCH_ASSOC);
$this->xml->Execute('SET NAMES "utf8"');
问题在哪里 试试这个简单的课程
class AdoConnection {
public $dbh;
public function __construct() {
include_once '../adoconnection/adodb5/adodb.inc.php'; // include your adodb.inc.php file
$server = "127.0.0.1";
$user = "USER/SCHEMA/Database";
$pwd = "password";
$db = "SID OR Service_Name";
$this->dbh = NewADOConnection('oci8');
$this->dbh->Connect(FALSE, $user, $pwd, '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ' . $server. ')(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = ' . $db . ') (SID = ' . $db . ')))');
}
public function select($sql) {
$result = $this->dbh->Execute($sql);
$result = $result->GetRows();
return $result;
}
public function insert($sql) {
$result = $this->dbh->Execute($sql);
return $result;
}
}
$dbh = new AdoConnection();
$dbh->select($sql);
$dbh->insert($sql);
只需保留错误报告并显示错误即可查看错误
ini_set('display_errors',1);
error_reporting(E_ALL);
有什么问题?您是否收到错误消息?是的,致命错误:对非对象执行的成员函数的调用