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();

Re: [PHP] function misfunction

2002-12-30 Thread Martin S
Jason Wong wrote: > On Monday 30 December 2002 22:07, Michael Sims wrote: >> On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: >> >function setCurrentDevGroup($devID) >> >{ >> >// start original routine >> >$query = "SELECT dev_group FROM tracking WHERE (computer >> >

Re: [PHP] function misfunction

2002-12-30 Thread Marek Kilimajer
Besides what Michael and jason said, you seem not have the $tracking initialized (it is not an object). You need to call $tracking=new tracking(); somewhere in your code. Martin S wrote: I'm trying to redo a db lookup into a function. The function is placed in a class called tracking and declar

Re: [PHP] function misfunction

2002-12-30 Thread Jason Wong
On Monday 30 December 2002 22:07, Michael Sims wrote: > On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: > >function setCurrentDevGroup($devID) > >{ > >// start original routine > >$query = "SELECT dev_group FROM tracking WHERE (computer = > >

Re: [PHP] function misfunction

2002-12-30 Thread Michael Sims
On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: >function setCurrentDevGroup($devID) >{ >// start original routine >$query = "SELECT dev_group FROM tracking WHERE (computer = >

[PHP] function misfunction

2002-12-30 Thread Martin S
I'm trying to redo a db lookup into a function. The function is placed in a class called tracking and declared thus: function setCurrentDevGroup($devID) { // start original routine $query = "SELECT dev_group FROM tracking WHERE (computer =