Here is the complete script, the only thing I have removed is the comments....

Thanks for looking!
Jim

my $dbh = DBI->connect('DBI:mysql:farthing_valleyweb','farthing_farthi +n','ginajim') if ($type eq 'alpha') { $query = sprintf ( "SELECT name, address, city, phone FROM valley where name like '$search%' ORDER BY name LIMIT %d,%d", $start - 1, $per_page + 1); } else { $query = sprintf ( "SELECT name,address,city,phone FROM valley WHERE CONCAT_WS(' ',keywords,category) LIKE '%$searc +h%' ORDER BY name LIMIT %d,%d", $start - 1, # number of records to skip $per_page + 1); # number of records to select } my $tbl_ref = $dbh->selectall_arrayref ($query); $dbh->disconnect ( ); my @rows; my $z = @rows; if ($z = 0) { print "We are sorry, but your search did not return any results.<P />\ +n"; print "<input type=\"button\" value=\" Try again \" onClick=\"histor +y.go(-1)\">\n"; print "$tbl_ref\n"; } for (my $i = 0; $i < $per_page && $i < @{$tbl_ref}-1; $i+=2) { my @cells = @{$tbl_ref->[$i]}; # get data values in row $i my @cells2 = @{$tbl_ref->[$i+1]}; # get data values in row $i+1 @cells = map { defined ($_) && $_ ne "" ? escapeHTML ($_) : "&nbsp;" } @cells; @cells2 = map { defined ($_) && $_ ne "" ? escapeHTML ($_) : "&nbsp;" } @cells2; @cells="<b>$cells[0]</b><br>$cells[1]<br>$cells[2]<br>$cells[3]<br +>$cells[4]"; @cells2="<b>$cells2[0]</b><br>$cells2[1]<br>$cells2[2]<br>$cells2[ +3]<br>$cells2[4]"; push (@rows, Tr (td (\@cells),(td (\@cells2)))); } $page .= table ({-border => 0, width=> 550}, @rows) . br ( ); if ($start > 1) { my $url = sprintf ("%s?start=%d;per_page=%d;search=$search", url ( ), $start - $per_page, $per_page); $page .= "[" . a ({-href => $url}, "previous page") . "] &nbsp; &n +bsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; & +nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +&nbsp; &nbsp; &nbsp; &nbsp; "; } else { $page .= "&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp +; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "; } if (@{$tbl_ref} > $per_page) # live link { my $url = sprintf ("%s?start=%d;per_page=%d;search1=$search;type=$ +type", url ( ), $start + $per_page, $per_page); $page .= "[" . a ({-href => $url}, "next page") . "]"; } else # static text { $page .= ""; } $page .= "Search: $search Cat1: $cat1 Cat2: $cat2\n"; $page .= end_html ( ); print $page;

In reply to Re^2: Search 2 columns by JimJx
in thread Search 2 columns by JimJx

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.