Re: trouble passing DB object to constructor (fwd)

From: Date: Tue, 16 Sep 2003 01:59:17 +0000
Subject: Re: trouble passing DB object to constructor (fwd)
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7835@lists.php.net to get a copy of this message
Never mind.. Sorry for the extra traffic.. As it typically goes, this stupid programmer figured out the dumb error he was making not too long after posting.. Thanks...Paul... On Mon, 15 Sep 2003, Paul B Schroeder wrote: > Hmm.. Trying again.. Sorry if you're getting this as a dup... > > ---------- Forwarded message ---------- > Date: Mon, 15 Sep 2003 18:01:46 -0500 (CDT) > From: Paul B Schroeder <paulsch@haywired.net> > To: pear-general@lists.php.net > Subject: trouble passing DB object to constructor > > Hello all.. > > My main PHP code is as follows.. > > $db_conn = DB::connect("pgsql://apache@localhost/mydb"); > $pad_sess = new My_Session($db_conn); > > > In the file in which I define the My_Session class, I have this in it's > constructor: > > function My_Session($db_conn) { > // Whatever SQL statement > $sql = "SELECT session_data FROM sessions WHERE session_id=?"; > $db_conn->prepare($sql); > . . . . . > > > Whenever it gets the 'prepare' line in the constructor, I get an error saying: > > Fatal error: Call to a member function on a non-object in > /usr/local/paddock/util/pad_classes.php on line 101 > > > If I try to prepare statements in the main line of code using '$db_conn', > everything is fine.. So the problem must be in passing the DB object to the > constructor in my session class.. > I don't seem to have a problem with my own testing of passing my own objects > like this, so I'm stumped.. > > Anybody have any ideas as to why this may be happening?? > > > Thanks in advance...Paul... > > > > -- Paul B Schroeder <paulbsch "at" haywired "dot" net>

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