Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8142

Re: PEAR DB: "PHP Fatal error: Call to undefined method DB::query()"

From Christoph Becker <cmbecker69@gmx.de>
Newsgroups comp.lang.php
Subject Re: PEAR DB: "PHP Fatal error: Call to undefined method DB::query()"
Date 2013-01-29 10:19 +0100
Organization Aioe.org NNTP Server
Message-ID <ke8474$362$1@speranza.aioe.org> (permalink)
References <0a977961-c477-420e-9404-a9e027174b84@googlegroups.com>

Show all headers | View raw


Robert S wrote:

> Can somebody tell me where I am going wrong?  This all worked using
> my old code, but I got a lot of warnings about non static methods
> being called statically:

Apparently DB::connect() doesn't return an instance of the DB class.  So
instead of

  $dbh->connect( $dsn );

you have to call

  $dbh = $dbh->connect( $dsn );

But probably it's better to stick with your old code, and declare static
methods as such in the DB class:

  public static function connect($dsn) {...}

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

PEAR DB: "PHP Fatal error:  Call to undefined method DB::query()" Robert S <robert.schmidli@gmail.com> - 2013-01-29 01:03 -0800
  Re: PEAR DB: "PHP Fatal error:  Call to undefined method DB::query()" Christoph Becker <cmbecker69@gmx.de> - 2013-01-29 10:19 +0100
    Re: PEAR DB: "PHP Fatal error:  Call to undefined method DB::query()" Robert S <robert.schmidli@gmail.com> - 2013-01-29 02:35 -0800
      Re: PEAR DB: "PHP Fatal error:  Call to undefined method DB::query()" Christoph Becker <cmbecker69@gmx.de> - 2013-01-29 12:20 +0100
  Re: PEAR DB: "PHP Fatal error:  Call to undefined method DB::query()" Jerry Stuckle <jstucklex@attglobal.net> - 2013-01-29 07:58 -0500

csiph-web