Thank you for the suggestion, Cameron. I did find the answer there. Here's the solution for others who may have been interested:
<snip> Thanks to Brian for this... Here is the final code that did return all results of the query in lists in the web page template. The final caveat was to make sure that the variables in the HTML file, TMPL_VAR NAME=? reflected the names of the fields I was getting with the SQL query. So, in the HTML file it looked something like: <TMPL_LOOP NAME=SOL_LOOP> <tr> <td> <TMPL_VAR NAME=description> </td> <td> <TMPL_VAR NAME=solution> </td> </tr> </TMPL_LOOP> and the perl code was: #----------------------------------------------------- # reconcile incoming CGI values with perl variables #----------------------------------------------------- my $q = new CGI; my $search_phrase = $q->param('searchphrase'); #------------------------------------------- # ODBC connection to AHD database #------------------------------------------- my $dbh = DBI->connect("DBI:ODBC:$dsn",$db_username,$db_pwd) or die "Unable to connect: " . DBI->errstr; $dbh->{LongReadLen} = 1024 * 1024; my $sth = $dbh->prepare( " SELECT description, solution FROM ahd.crsol WHERE description LIKE '% $search_phrase %' " ); $sth->execute(); my $template = HTML::Template->new(filename=>'e:/inetpub/wwwroot/helpdesk/search_results.ht m'); my $rows; push @{$rows}, $_ while $_ = $sth->fetchrow_hashref(); $template->param( PHRASE=>$search_phrase, ); #print PERLLOG "$now: $template->param( SOL_LOOP=>$rows, );\n"; # make sure that the tmpl_var names in the html file match the fields in the select statement $template->param( SOL_LOOP=>$rows, ); print $template->output; -----Original Message----- From: Cameron Dorey [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 7:41 AM To: Perl-Win32-Web (E-mail) Subject: Re: generating data lists with html::template "Johnson, Nicole" wrote: > > Hello - > > I am trying to dynamically generate an HTML page that will list the data > from a table. For example, announcements posted to an internal system which > are duplicated on the web for users who wish to view them. Naturally I want > this web page to be reflective of what is actually 'announced' in the source > system each time the page is accessed. > > I have tinkered with TMPL_LOOPs all day, and while they seem to have been > the answer I can't get it work. Here is the code that does work, sans any > TMPL_LOOP stuff. My question is how to take what I have and incorporate > TMPL_LOOP (feel free to presume I understand the HTML template side of the > equation). I see your question has been answered, but are you on the HTML-template list? This might help you faster in the future. If you aren't, you can sign up by "sending a blank message to [EMAIL PROTECTED])." (from the module docs). Cameron -- Cameron Dorey Associate Professor of Chemistry University of Central Arkansas Phone: 501-450-5938 [EMAIL PROTECTED] _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ****************************************************************** This email and any files transmitted with it from the ElPaso Corporation are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. ****************************************************************** _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs