function misfunction

From: Date: Mon, 30 Dec 2002 13:48:13 +0000
Subject: function misfunction
Groups: php.general 
Request: Send a blank email to php-general+get-129655@lists.php.net to get a copy of this message
I'm trying to redo a db lookup into a function. The function is placed in a class called tracking and declared thus: function setCurrentDevGroup($devID) { // start original routine $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; return($lookuptable); } //end original routine } This is called from the code as: $tracking->setCurrentDevGroup($this->ComputerID); // $this->ComputerID is // known as eg 5. In the page which relies on the value of setCurrentDevGroup I get: Call to a member function on a non-object in /www/htdocs/dev/include/irm.inc on line 2857 Line 2857 is the one starting "$tracking->" above. Obviously I'm doing something wrong here. What? Cheers, Martin S.

« previous php.general (#129655) next »