try this:
my @rows = ();
while ( my $data = $sth->fetchrow_hashref() ) {
push @rows, $data;
}
$template->param(ROWS => \@rows);
regards,
Ben
-----Original Message-----
From: Doc [mailto:[EMAIL PROTECTED]]
Sent: 22 September 2002 15:10
To: [EMAIL PROTECTED]
Subject: [htmltmpl] HTML-Template and DBI
I have attempted to make HTML-Template to work with DBI and fetching database results
using
Perlmonk code:
push @{$rows}, $_ while $_ = $sth->fetchrow_hashref();
my $template = HTML::Template->new(filename => 'songs.tmpl');
$template->param(ROWS => $rows);
print $template->output();
and code here:
my $template = HTML::Template->new( filename => 'showclient.html' ) ;
my ($data,$rows,$template);
while( $data = $sth->fetchrow_hashref() ) { push( @{$rows} , $data ); }
$template->param( { ROWS => $rows } ) ;
print $template->output();
It always fails on template->param function. I know about fetchall but I also read it
creates more work for Perl so I stook to this. Please help me out.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users