Re: Call to a member function on a non-object
| From: | Lukas Smith | Date: | Thu, 05 Feb 2004 22:29:11 +0000 |
| Subject: | Re: Call to a member function on a non-object | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-10523@lists.php.net to get a copy of this message | ||
Eric M. Wulff wrote:
$dbh->query($qry); gives me: Fatal error: Call to a member function on a non-object
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()); }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. you are not running php5 by chance? in that case the problem is in isError and the get_class call. regards, Lukas Smith smith@backendmedia.com _______________________________ BackendMedia www.backendmedia.com berlin@backendmedia.com Linn Zwoch Smith GbR Pariser Str. 44 D-10707 Berlin Tel +49 30 83 22 50 00 Fax +49 30 83 22 50 07