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
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
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);
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
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
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 =
> $
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.
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
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:
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 = $
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
>> >
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
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 =
> >
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 =
>
14 matches
Mail list logo