in reply to Re: Code factory
in thread Code factory

Why not go a step farther?
sub getByFieldval { my ($table, $field, $val) = @_; my $dbh = sqlConnect(); my $sth = $dbh->prepare("SELECT * FROM $table WHERE $field=?"); $sth->execute($val); my $result = $sth->fetchrow_hashref(); $sth->finish(); return $result; }
Of course I would probably do more error checking.

--

flounder