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

$names = $select->fetchall_arrayref(); foreach $names ( @$names) { ($variable1, $variable2, $variable3) = @$names; }

and then

$template->process (\$templ, { list => \@names }) or die $template->error;

I bet this last names you wanted it to be the other names and not the names perl has in mind.

names, names, all these names!!! fix these (and what others told you) and your program will be happier: re the joy of anonymity...

bw, a horse with no name

Replies are listed 'Best First'.
Re^4: using template on same page
by bigup401 (Pilgrim) on Sep 16, 2018 at 11:27 UTC

    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>

      { 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; }