troubles with db classes
| From: | Burak DAYIOGLU | Date: | Mon, 12 Mar 2001 11:14:48 +0000 |
| Subject: | troubles with db classes | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1795@lists.php.net to get a copy of this message | ||
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();
?>