Re: Function misfunction - 2
| From: | Marek Kilimajer | Date: | Tue, 31 Dec 2002 11:30:51 +0000 |
| Subject: | Re: Function misfunction - 2 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129758@lists.php.net to get a copy of this message | ||
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 lineecho $lookuptable; // gives an empty string.