Assuming you want your template var names to match your field names from 
your table...

my $row = $sth->fetchrow_hashref;

$template->param(%$row);

Cheers!

P


On Wed, 10 Apr 2002, Kenny Pyatt wrote:

> Hello,
> 
> I am looking for a more attractive way to catch data from a query and 
> assign it to params in the template.
> 
> This is what I am doing.  Is there a "better" way?  Perhaps a dynamic 
> method that I could use.
> 
> # the query goes here
> my ($one, $two, $three) = $sth->fetchrow_array;
> 
> $template->param('one', $one);
> $template->param('two', $two);
> $template->param('three', $three);
> 
> I am playing with the $template->param() call to get a list of params 
> but I am not sure how to line up the variables
> set by the query with the variables in the param.  How do you do this?
> 
> Thanks,
> Kenny Pyatt
> President
> Design Shack
> www.dshack.com
> 
> P.S. I actually use HTML::Template via CGI::Application (in case that changes the 
>answer).
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to