>> Perhaps folks are thinking of fetchrow_hashref which DOES return column
>> names.
> I agree. I think people are confusing array with a hash in DBI.
Indeed.
Is there a particular reason you want to use fetchall_arrayref?
If what you want is a loop called ROWS that contains all the rows from your
query with vars named for each column, you might want to think about using
selectall_arrayref (which returns a reference to an array of hashrefs, just
like a loop), like so:
my $arrayref = $dbh->selectall_arrayref( $query, { Columns => {} } )
Then you've got your loop data, and all you have to do is name it:
$template->param(ROWS => $arrayref);
Of course, you'll want some error handling, because if no rows are returned,
you'll get an error complaining that the parameter is not a TMPL_VAR, and
your template won't parse.
Brian McCain
PageMasters Internet Group
>> See DBI doc on how to use DBI
>> http://search.cpan.org/author/TIMB/DBI-1.14/DBI.pm
>>
>>
>> Steve Ragan
>> Sr. Internet Developer
>> Harris Internet Services
>> 2500 Westchester Ave.
>> Purchase, NY 10577
>> 914-641-3948
>> [EMAIL PROTECTED]
>>
>>
>> -----Original Message-----
>> From: Doc [mailto:[EMAIL PROTECTED]]
>> Sent: Thursday, September 26, 2002 2:18 PM
>> To: Andrew Brosnan; [EMAIL PROTECTED]
>> Subject: Re: [htmltmpl] HTML-Template and DBI
>>
>>
>> That didn't make any sense whatsoever.
>>
>> DBI does not return column names in results.
>>
>> H-T needs column names to assign values to <TMPL_VAR NAME=VARNAME>
>>
>> So How is it possible to use $template->param(ROWS =>
>> $sth->fechall_arrayref({}));
>> when arrayref does not supply H-T what needs to perform it's function?
-------------------------------------------------------
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