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 ($_) : " " } @cells; @cells2 = map { defined ($_) && $_ ne "" ? escapeHTML ($_) : " " } @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") . "] &n +bsp; & +nbsp; + "; } else { $page .= " + +   +; "; } 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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |