
sleuth
Enthusiast
Dec 4, 2000, 11:05 PM
Post #2 of 3
(520 views)
|
|
Re: How Can I Display Search Results 10 By 10
[In reply to]
|
Can't Post
|
|
It's a little complex if you consider the next & prev buttons, it's a pain to me anyway, hehe, Basically it's like this, You loop through the data: open(file, "<file.cvc"); while(<file> ) { (@res)=split(/\|/, $_); } close(file); K, now that you have looped through it, count each line by adding $var++; open(file, "<file.cvc"); while(<file> ) { (@res)=split(/\|/, $_); $c++; } close(file); Now you can say, if ($c > 0 && $c < 11){ print "Results 1-10"; } Totalling up too, open(file, "<file.cvc"); while(<file> ) { (@res)=split(/\|/, $_); $c++; if ($c > 0 && $c < 11){ print "Results 1-10"; } } close(file); See what I mean? Then for the next button, you want to pass the variable that's going to be 10 + what was the last set of results, like if your on 1 - 10, then add 10 to 10 to get 20 and pass that to the script and instead of $c < 10 do $c < $var and $var will be what you passed to the script. Getting to complicated I know, ok, Script: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> if (!$in{'start'}){ #nothing defined for beinging, use 0 $being = 0; }else{ $begin = $in{'start'}; } ## Get ending number if (!$in{'end'}){ #end not defined, use 10 $end = 10; } else{ $end = $in{'end'}; } ########### # Determine beginning & end for next button ########### $next_end = $end + 10; $next_begin = $begin + 10; ########### open(file, "<file.cvc"); while(<file> ) { (@res)=split(/\|/, $_); $c++; if ($c > $begin && $c < $end){ print "Results 1-10"; } } close(file); if ($next_end > $c){ #$next_end is greater than the number of records found, make it the same number $next_end = $c; } # for next button, pass $next_end & $next_beginning to the script. via link </pre><HR></BLOCKQUOTE> See what I'm getting at, Sleuth P.S. Sorry 4 being to fast, but I'm really tired.
|