Besides what Michael and jason said, you seem not have the $tracking initialized (it is not an object).
You need to call $tracking=new tracking(); somewhere in your code.

Martin S wrote:

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.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to