trouble passing DB object to constructor

From: Date: Mon, 15 Sep 2003 23:01:46 +0000
Subject: trouble passing DB object to constructor
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7831@lists.php.net to get a copy of this message
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 (#7831) next »