bigup401 has asked for the wisdom of the Perl Monks concerning the following question:

my select script

if ($input) { my $search = $DBH->prepare("SELECT * FROM tble WHERE CONCAT(NAME, ', ' +, AGE, ', ', COUNTRY) LIKE ?"); $search->execute('%'.$input.'%'); my $row; while (my $row = $search->fetchrow()) { print "$row\n"; } }

output

Jane Deo John Deo

my problem is here. any advice or example. how i can get all output per div instead printing only 1

my html

------------ John Deo HTML DIV------------ <div class="infono"> <h6>$scal #John Deo</h6> </div> <span class="infono_id"> <a href="#" class="user_edit"> Edit Name </a> </span> ------------ John Deo HTML DIV END ------------ ------------ NEXT IS JANE DEO HTML DIV -------- ------------ END OF JANE DEO -------------------

i want to get also Jane Deo div after john deo

Replies are listed 'Best First'.
Re: output div tag inside html
by marto (Cardinal) on Sep 12, 2018 at 17:34 UTC

      no other way without mojo and template kit

        Sure, write some code to loop through your results and output whatever it is you want.

Re: output div tag inside html
by poj (Abbot) on Sep 13, 2018 at 09:09 UTC
    how i can get all output per div

    Do you mean all the fields returned by SELECT * ... ?

    while (my @row = $search->fetchrow_array()) { print "@row\n"; }
    poj

      this is wat i mean now

      i want to get

      <li> #Foo </li> <li> #bar </li> <li> #moo </li>
      use CGI::Pretty ":standard"; @names = ('Foo', 'Bar', 'Moo'); my $str = join(" ",@names); $data = li ( div({"class='inforno'"}, "<img src='inforno>'"), div({"class='inforno'"}, "<a href='#' class='inforno'>$str< +/a>"), span({"class='inforno'"}, "<a href='#' class='inforno'> Edit user </a>") ); print "$data\n";

        You can’t get pretty printing today without hoops. Hoops == code smell. This prints what you want without spacing. Templates or HEREDOCs are better by far for what you want; as I think might have already been mentioned. Maybe. :P

        use strict; use CGI ":standard"; my @names = ('Foo', 'Bar', 'Moo'); print li([ map "#$_", @names ]); __END__ <li>#Foo</li> <li>#Bar</li> <li>#Moo</li>