I found your snippet a bit tricky to digest so I've blown some whitespace into it.

sub retrieve { my $self = shift; use Data::Dumper; my $q = $self->query; my $tmpl = $self->load_tmpl( "showitem.html", loop_context_vars =>1, associate => $q ); $tmpl->param( product => $self->dbh->selectall_arrayref( q[ SELECT image, price, description, serial FROM product WHERE id = ? ], { Slice => {} }, $q->param('item') ) ); return $frm->build_page( { title => "Boyo's Place: " . $self->dbh->selectrow_array( q[ SELECT name FROM product WHERE id=? ], { Slice => {} }, $q->param('item') ), output => $tmpl->output } ), $q->code(Dumper(\$tmpl)); }
I would use a lot of temp vars to simplify the code and help establish what is happening.

e.g.

my $arrayref = $self->dbh->selectall_arrayref( etc.... die Dumper $arrayref; # on a subsequent run my $arrayref2 = $self->dbh->selectrow_array( etc... die Dumper $arrayref2; # and even die Dumper $q->param('item');
You need to be sure you are feeding your template loop an array of hash refs. Each hash ref will need

item => $item_value

in it. You may have to loop through the dbh output yourself to put that in.

Hope that helps


In reply to Re^3: CGI::Application/HTML::Template problem by wfsp
in thread CGI::Application/HTML::Template problem by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.