pgsql.php problems: possible weirdness

From: Date: Fri, 02 Mar 2001 13:27:22 +0000
Subject: pgsql.php problems: possible weirdness
Groups: php.pear 
Request: Send a blank email to php-pear+get-1545@lists.php.net to get a copy of this message
hello all, I am having a page in which I initialize a pgsql connection with something like the below: $dsn=array(phptype => DNS_DATABASE, hostspec=> "localhost", database=> "dns"); $database=DB::connect($dsn); after setting up a connection, I (surely) can query database and make various operations on it. However, when it comes to passing a connection handle to a class there comes the problems: I am having a contact class with such a constructor: class contact { function contact(&$dbHandle) {} } In the php code of the PAGE, i write such a line to instantiate a new contact: $x=new contact($database); However when I try to use one of the db aware methods of contact class (just as the one below) I get warnings: function dummy() { $this->dbHandle->autoCommit(FALSE); $queryStr="select * from contact order by contactid desc"; $handle=$this->dbHandle->query($queryStr); if (DB::isError($handle)) { echo "there is an error"; } $count=$this->dbHandle->numrows($handle); $myrow=$this->dbHandle->fetchrow($handle); } Warning: Illegal offset type in DB/pgsql.php on line 256 Warning: Illegal offset type in DB/pgsql.php on line 256 (using latest pgsql.php from CVS) when vardumped, $this->dbHandle and $handle look as instances of appropriate classes; but var_dump($count) shows object(db_error)(10) { ["error_message_prefix"]=> string(0) "" ["error_prepend"]=> string(0) "" ["error_append"]=> string(0) "" ["mode"]=> int(1) ["level"]=> int(1024) ["code"]=> int(-1) ["message"]=> string(23) "DB Error: unknown error" ["debuginfo"]=> string(0) "" ["userinfo"]=> string(74) "select * from contact order by contactid desc" ["callback"]=> NULL } anybody with any ideas? I've had been using PEAR for some time but this error seemed weird to me... with regards, -bd

« previous php.pear (#1545) next »