Um.... where is $lookuptable set? Seems like you should have:

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

andy

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.
--
   Give a man a fish and you feed him for a day; teach him to
         use the Net and he won't bother you for weeks.



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

Reply via email to