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

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

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

    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

      but its there wen u look at the code and $info is just user input to confirm weather there is an input from user to execute the condition

      but anyway am trying it differently coz it has given alot problem to me and monks to figure it out. just gone try other method to accomplish wat i want

        Your SQL 'SELECT FOO, BAR, MOO FROM tble ...' returns records with 3 fields FOO, BAR and MOO.

        If you want to display only the value in FOO use [% name.0 %] in the template, if BAR use [% name.1 %] and if MOO use [% name.2 %]. The values 0,1,2 corresponding to the position of each field in the select.

        Best practice would be to select only the fields you need.

        poj