Call to a member function on a non-object
| From: | Eric M. Wulff | Date: | Thu, 05 Feb 2004 21:59:31 +0000 |
| Subject: | Call to a member function on a non-object | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-10522@lists.php.net to get a copy of this message | ||
Hi, hope this question isn't too elementary but I'm new to php and PEAR
and I'm following a few simple examples to simply connect to a local
pgsql or mysql db and extract some data via a select. I know I'm
connecting but can't figure out for the life of me why I'm getting the
following error upon...
$dbh->query($qry);
gives me: Fatal error: Call to a member function on a non-object
At least, the line referred to by this error is the line of the code
copied above. Perhaps the problem is actually elsewhere. Can anyone
advise? Docs, google searches have been no help.
thx
Eric
more of the code...
// this all seems to work as I get no error. Why is $dbh not holding a
// connection object?
$dbh = DB::connect($dsn);
if(DB::isError($dbh)) { die ($dbh->getMessage()); }
$qry = "SELECT * FROM tbl_moves";
// the line below is that which the error refers too
$qryResult = $dbh->query($qry);