Indeed...I think that's sort of the same thing I said, only clearer. I was
writing a response to Doc's original post earlier and I think I thought that
some of the wording I used in that message was included in the one I ended
up sending, which might have been a bit confusing.

:)

Ah, here, found it. This is the more generic version of what I did...

Doc's using DBI to get his data, so I'll put up the DBI-specific part of my
code as well...Even though he's using fetchrow_hashref with a while loop and
I'm using selectall_arrayref, we end up with the same data structure.

# Get the data...

$arrayref = $dbh->selectall_arrayref( $query, { Columns => {} } );

# arrayref now contains a reference to an array of hashrefs...ie, a loop.
# or, if no data was returned, arrayref is undefined.

$arrayref = [ {} ] if !$arrayref;

# This sets up arrayref as an EMPTY loop, which wont display any data, but
# will keep H:T from throwing an error.

Hope this helps.

Brian McCain
PageMasters Internet Group


----- Original Message -----
From: "Kenny Smith" <[EMAIL PROTECTED]>
To: "Brian McCain" <[EMAIL PROTECTED]>; "Doc" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, October 10, 2002 3:22 PM
Subject: RE: [htmltmpl] Error code.


| Hey Brian,
|
| I believe the error is prompted by ref( $data->{'rows'} ) not being
"ARRAY",
| most likely rows is undef() or something along those lines. I could
totally
| be wrong though, this is just my experience.
|
| To fix it, I usually use something along the lines of
|
| $data->{'rows'} = get_my_rows() || [] ;
|
| Although, I would never actually name the variable 'rows'.
|
|  :)
|
| > But seriously Doc, lighten up, and remember that we're
| > trying to help you out of the goodness of our hearts and
| > our wish to support other developers using HTML::Template.
|
| As those "cooler" than I say... "word." :)
|
|
| Kenny Smith
|
|



-------------------------------------------------------
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

Reply via email to