i figured out number 1 by using another thread:
my ($table, $field, $value) = @_;
my $sth = $DB->table($table)->select({ $field => $value });
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}
however, this looks like a one-to-many relationship and my purpose will always be one-to-one. i think i should get rid of the while, but probably need a different statement to get the one record that matches my username. what should i change?
and i still need help with #2. thanks
Code:
sub { my ($table, $field, $value) = @_;
my $sth = $DB->table($table)->select({ $field => $value });
my @output;
while (my $rs = $sth->fetchrow_hashref ) {
push @output, $rs;
}
return { loop_hash => \@output };
}
however, this looks like a one-to-many relationship and my purpose will always be one-to-one. i think i should get rid of the while, but probably need a different statement to get the one record that matches my username. what should i change?
and i still need help with #2. thanks