in reply to Re^3: using template on same page
in thread using template on same page

sorry it was wrong writing but its. i mistake @names with @$names. but thats the code. i dont know failed to pull from db just outputing

ARRAY(0x2190674) ARRAY(0x2190674) ARRAY(0x2190684)
$template->process (\$templ, { list => \@$names }) or die $template->error;
</code>

Replies are listed 'Best First'.
Re^5: using template on same page
by poj (Abbot) on Sep 16, 2018 at 17:15 UTC

    { list => \@$names } is the same as { list => $names }

    I'm guessing you just need to change your template to

    <a href='#' class='inforno'>[% name.0 %] [% name.1 %] [% name.2 %]</a>

    poj

      i tried that bt the problem i get repeated output like

      FOO FOO BAR BAR MOO MOO

      i changed my code from

      my $select = $DBH->prepare("SELECT FOO, BAR, MOO FROM tble WHERE CONCA +T(FOO, ', ', BAR, ', ', MOO) LIKE ?"); $select->execute('%'.$info.'%'); $names = $select->fetchall_arrayref(); foreach $names ( @$names) { ($variable1, $variable2, $variable3) = @$names; } }

      to this

      my $select = $DBH->prepare("SELECT FOO, BAR, MOO FROM tble WHERE CONCA +T(FOO, ', ', BAR, ', ', MOO) LIKE ?"); $select->execute('%'.$info.'%'); $names = $select->fetchrow_arrayref(); ($variable1, $variable2, $variable3) = @$names; }

        I don't see $variable1, $variable2, $variable3 used anywhere in your code posted here, what are they for ? And what is the value of $info ?

        poj