sub getQuestionaire { my($col, $count); $count=0; text('Here is the questionaire info:'); print ""; print ""; foreach $col(@cols){ print ""; } print ""; my $table='p_questionnaire'; my $fields=join(",",@cols); my($sth); my $sql = qq{SELECT $fields FROM $table ORDER BY patient_id}; $sth = $dbhSt->prepare($sql); $sth->execute; my %rec =(); $sth->bind_columns(map {\$rec{$_}} @cols); while ($sth->fetchrow_arrayref){ if($count eq 25){ print ""; foreach $col(@cols){ print ""; } print ""; $count=0; } print ""; foreach $col(@cols){ my $val= $rec{$col}; if($val eq ''){ $val='NULL'; } print ""; } print ""; $count=$count +1; } $sth->fetchrow_arrayref; $sth->finish; print "
$col
$col
$val
"; }