Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

problem executing ther global

Quote Reply
problem executing ther global
Hi ,

I wrote this code to extract data from a database

sub {
my $tags = GT::Template->tags;
my($accountid,$clientid,$output);
my($table33,$sth33);
$accountid = $tags->{AccountID};
$table33 = $DB->table('tblClients');
$sth33 = $table33->select (['ClientID'], {AccountID => $accountid});
$sth33->execute();
$clientid = $sth33->fetchrow();
$output= $clientid;
return $output;
}



I call this global ... in a file ... <% global-nAME%> . intead of executing the global and printing the client ID .. it prints the whole code ( subroutine) itself ..

how do i get about this ..
Quote Reply
Re: [sdsouza] problem executing ther global In reply to
You should change the script a bit:

sub {
my $tags = GT::Template->tags;
my $accountid = $tags->{AccountID};
my $table33 = $DB->table('tblClients');
my ($clientid) = $table33->select ({AccountID => $accountid}, ['ClientID'])->fetchrow_array;
return $clientid;
}

Ensure that there is no space in <%global_name%>

TheStone.

B.
Quote Reply
Re: [sdsouza] problem executing ther global In reply to
You didn't need to start a new thread.

I answered your question in http://gossamer-threads.com/...orum.cgi?post=255006

You could have just continued your question there.

Simon.