Ok... Now it is making a bit more sense. I understand the $info part now... makes sense. What does the "my $tags = GT::Template->tags;" do? I've seen that several places in the script.
Now when I do the script, as told, I get nothing back because It probably doesn't assign the return data to anything: <%Dbsql::custom::GetCarrier('000000')%>. So I modified it to be <%set Carrier = Dbsql::custom::GetCarrier('000000')%> in the template which should lookup the Primary Key (000000) in Table 'Patients' and return the data in the column called Carrier. (by the way, the database data DOES exist... I checked three times) But I just get a "blank" variable for 'Carrier'. I even tried getting the entire $info HASH but it still returns nothing. How do I debug whether there are any errors and or check to see if the database is indeed being accessed?
Original script:
sub GetCarrier {
#--------------------------------------------------------------------
# Lookup data in another database.
# $id = PK value
my $id = shift;
my $tags = GT::Template->tags;
my $info = $tags->{home}->{sql}->table('Patients')->get ('$id');
return $info->{'Carrier'};
}
Now when I do the script, as told, I get nothing back because It probably doesn't assign the return data to anything: <%Dbsql::custom::GetCarrier('000000')%>. So I modified it to be <%set Carrier = Dbsql::custom::GetCarrier('000000')%> in the template which should lookup the Primary Key (000000) in Table 'Patients' and return the data in the column called Carrier. (by the way, the database data DOES exist... I checked three times) But I just get a "blank" variable for 'Carrier'. I even tried getting the entire $info HASH but it still returns nothing. How do I debug whether there are any errors and or check to see if the database is indeed being accessed?
Original script:
Code:
sub GetCarrier {
#--------------------------------------------------------------------
# Lookup data in another database.
# $id = PK value
my $id = shift;
my $tags = GT::Template->tags;
my $info = $tags->{home}->{sql}->table('Patients')->get ('$id');
return $info->{'Carrier'};
}