You forgot global $adb; at the beginning of your function, or use

$sth = $GLOBALS['adb']->prepare($query);



Martin S wrote:

NOW what am I doing wrong??

function setCurrentDevGroup($devID)
{
$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"];
}
echo $lookuptable; // gives e.g. printers
return $lookuptable; // will not return the value to ....
}

.
.
.
setCurrentDevGroup($this->ComputerID); // calling function
$query = "SELECT name FROM $lookuptable WHERE (ID = $this->ComputerID)";
//debug line
echo $lookuptable; // gives an empty string.


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

Reply via email to