Re: [PHP] Function misfunction - 2

2002-12-31 Thread Andrew Wallace
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

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Marek Kilimajer
so you want $lookuptable=setCurrentDevGroup($devID); switch($lookuptable) { ... Martin S wrote: Jason Wong wrote: On Tuesday 31 December 2002 20:48, Martin S wrote: This is the function which should return e.g. "printers" for $lookuptable. But doesn't. function setCurrentDevGroup($dev

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Jason Wong wrote: > If you want it so that the value of $lookuptable (in the global scope) is > changed when you call your function then you have to do something like: > >function doo($dah, $dee, $etc) { > global $lookuptable; > $lookuptable = "Hello world"; > } > > doo(1, 2, 3);

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Jason Wong
On Tuesday 31 December 2002 21:44, Martin S wrote: > > But something like: > > > > echo setCurrentDevGroup($devID); > > That gives the correct value as well. But I wanted it as a variable > ($lookuptable) ... > > What I am trying to do is: > > setCurrentDevGroup($this->Computer); // call functio

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Jason Wong wrote: > On Tuesday 31 December 2002 20:48, Martin S wrote: > >> This is the function which should return e.g. "printers" for >> $lookuptable. But doesn't. >> >> function setCurrentDevGroup($devID) >> { >> global $adb; >> $query = "SELECT dev_group FROM

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Jason Wong
On Tuesday 31 December 2002 20:48, Martin S wrote: > This is the function which should return e.g. "printers" for $lookuptable. > But doesn't. > > function setCurrentDevGroup($devID) > { > global $adb; > $query = "SELECT dev_group FROM tracking WHERE (computer = > $

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Jason Wong wrote: > On Tuesday 31 December 2002 20:02, Martin S wrote: >> Marek Kilimajer wrote: >> > You forgot global $adb; at the beginning of your function, or use >> > >> > $sth = $GLOBALS['adb']->prepare($query); >> >> Nope sorry, I've just edited it from my post here. It is in the function.

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Jason Wong
On Tuesday 31 December 2002 20:02, Martin S wrote: > Marek Kilimajer wrote: > > You forgot global $adb; at the beginning of your function, or use > > > > $sth = $GLOBALS['adb']->prepare($query); > > Nope sorry, I've just edited it from my post here. It is in the function. Hmm, whenever you post co

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Martin S
Marek Kilimajer wrote: > You forgot global $adb; at the beginning of your function, or use > > $sth = $GLOBALS['adb']->prepare($query); Nope sorry, I've just edited it from my post here. It is in the function. /Martin S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Function misfunction - 2

2002-12-31 Thread Marek Kilimajer
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 = $

[PHP] Function misfunction - 2

2002-12-30 Thread Martin S
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();