Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用wamp服务器中的adodb连接到数据库_Php_Connection_Wamp_Adodb - Fatal编程技术网

Php 使用wamp服务器中的adodb连接到数据库

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

我尝试使用ADODB插件连接到WAMP服务器中的数据库,但无法连接,我的代码如下:

$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);

有什么问题?您是否收到错误消息?是的,致命错误:对非对象执行的成员函数的调用