troubles with db classes
[email protected] (Burak DAYIOGLU) Mon, 12 Mar 2001 13:14:48 +0200
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I'm having trouble using DB classes from inside other classes. The below
code doesn't work and I couldn't be able to figure out why. Can anybody
help?
var_dump of $handle always return db_error instance information with
no particular detail. (DNS_DATABASE==pgsql)
thanks,
-bd
<?php
require_once("DB.php");
require_once("/code/config.php");
class sample {
var $dbHandle;
function sample(&$database) {
$this->dbHandle=$database;
}
function execute() {
$query="insert into host values (9,'test','test')";
$handle=$this->dbHandle->simplequery($query);
var_dump($handle);
}
}
$dsn=array(phptype=>DNS_DATABASE,hostspec=>"localhost",database=>"dns");
$database=DB::connect($dsn);
$x=new sample(&$database);
$x->execute();
?>