http://www.perlmonks.org?node_id=366541

bar10der has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I want to display contents of my oracle table for users to edit it. There are more than 60 fields in the table. I have a saperate table which hold the column names. This is what I am doing-
#Select fieldnames from accfields table in @fields. my @fields = getMultiRows($sql,1,$dbh); ##A saperate perl routine to e +xtract data. my $fields = join(",",@fields); $sql = "SELECT $fields FROM tran WHERE account=?"; my $sth = $dbh->prepare($sql); if(!$sth){$err= "Error preparing query " . $sql . " : ". $dbh->errstr; +} if(!$sth->execute(177)){$err = "Error Executing query " . $sql . " : " +. $dbh->errstr;} my %rows = $sth->fetchrow_hashref; # Now i get the html template and want to populate html form fields wi +th data extracted. All form field names are same as table column na +me. foreach(@fields){ $template->param($_=>$rows{$_}); } return $template->output;
The form is displayed but fields do not show data extracted from database! Where am I making mistake? The html tag in form is -
<input type="text" name="fname" size="40" maxlength="60" value="<!-- T +MPL_VAR fname -->"><!-- TMPL_VAR err_fname -->