Re: Call to a member function on a non-object
| From: | Jeroen Houben | Date: | Fri, 06 Feb 2004 09:20:40 +0000 |
| Subject: | Re: Call to a member function on a non-object | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10525@lists.php.net to get a copy of this message | ||
Lukas Smith wrote:
Eric M. Wulff wrote:Could it be because of not using =&, but = ? Jeroen$dbh->query($qry); gives me: Fatal error: Call to a member function on a non-objectmore 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()); }please add: var_dump($dbh);$qry = "SELECT * FROM tbl_moves"; // the line below is that which the error refers too $qryResult = $dbh->query($qry);now this is all a little odd. this error usually occurs because the dsn is incorrect, which then means that DB::connect() returns an error object and not an instance if DB. however the call to DB::isError should have picked that one up.