Re: Function misfunction - 2

From: Date: Tue, 31 Dec 2002 17:41:03 +0000
Subject: Re: Function misfunction - 2
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-129784@lists.php.net to get a copy of this message
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.

« previous php.general (#129784) next »