Re: DB error checking, returns error when query works?

From: Date: Wed, 01 Oct 2003 21:55:16 +0000
Subject: Re: DB error checking, returns error when query works?
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8210@lists.php.net to get a copy of this message
Just gave it a try and I get the same error as I did with fetchRow. Fatal error: Call to a member function on a non-object in /srv/www/etc/functions.php on line 103 And it no longer updates the database. This is the code I'm using: $result = $dbh->query($query); if(!DB::isError($result)) {
       die($result->getMessage());
} else {
       print "It worked!";
} $dbh->disconnect(); I'm using this in a funtion if that matters at all. Keith Pierre-Alain Joye wrote:
On Wed, 01 Oct 2003 15:27:52 -0600 Keith Pettit <keith@setuplinux.com> wrote:
This is my first time using pear DB and it seems to be working. I'm doing some update statements which work, but the error checking is still showing errors. Here is what I'm doing... $query = "UPDATE test set ......"; $result = $dbh->query($query); if(!DB::isError($result)) {
       print "ERROR: $result \n";
} else {
       print "It worked!";
}
it should be: if(DB::isError($result)) { die($result->getMessage();); <=== only for this example :) } else { print "It worked!"; } pierre


« previous php.pear.general (#8210) next »