Link to home
Start Free TrialLog in
Avatar of leoleo
leoleo

asked on

Displaying pages of search


When we search for something using a SearchEngine, they show the result in different pages, so that when we click on "Next" (or page 1, 2, 3 ..), it brings the remaining results. How is it done?
 
What I require is this: I am searching from a database. The select query returns, say 40 rows, and I want to show them 10 at a time, with "Next" link at the bottom. (Also links to pages 1, 2 etc.). What program shld I call at the Next link, and also the page 1, 2 etc links?

Hope my question is clear.
Thanks indeed.
Avatar of leoleo
leoleo

ASKER

Adjusted points from 30 to 50
Avatar of leoleo

ASKER

Is there a way using JavaScript, like all the rows have been selected, but only 10 are shown etc...?

I think if it is a JavaScript soln, it will bw faster, right?

that feature has nothing to do with any client-side program.

its the ability of the search engine to show only certain set of results at a time.

it can be simulated using PERL too, provided you have the search engine configured and running.
Avatar of leoleo

ASKER

What do you suggest I do?
i would say that you first get a search engine installed, configured and running.

After that writing the PERL script is not something that will take more than a day.

I would say that if you use ASP I've got the solution for you.
Avatar of leoleo

ASKER

CJ_S: I can't use ASP, but do you think you can give me some logic which I can convert to Perl & use???

maneshr : For a little Database query returning 40-50 rows, shld I go for a search engine? I was hoping you could provide me a better or even a round-about solution which gives the same result. It is actually a small part of a big problem so I dont want to go to many difficulties for it.

Sure, I cannot say how Perl retrieves the RecordSet but here goes in ASP/VB

..... Connectioon stuff an all.

Set rs = Conn.Execute(Sql-statement)
start = request("start")
count = 10

for i=0 to (start * count)
   rs.movenext
next
i=start*count

while not rs.eof and i <= (start+1)*count
   ......write everything out here......
   rs.movenext
wend

<a href='samepage.htm?start=' & start+1>next</a>

this stuff _SHOULD_ get you forward every time, were I at my work I wouldve copied and paste the code and you would have it all tested etc etc....but thisis for VB / ASP......so you defeinitely should change a few things.

Good luck,
CJ
Avatar of leoleo

ASKER

I think I get the idea ... let me try it out. As you said, there will be changes to be incorporated. I will get back soon.

ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of leoleo

ASKER

Michel: If I do that, will there be extra overhead? I mean there won't be any difference, will there, whether the page loads with 10 results or 50? [I am just assuming that the no: of rows won't be much greater than 50.]

Anyway I will try out the solns you both have provided, and will let you know soon.

CJ: I was too lazy to try it out this weekend ;o)

There will be only the overhead of 40 more results.
However the user saves 4 server connections

Michel
Avatar of leoleo

ASKER

> the user saves 4 server connections

That's a valid point.
Avatar of leoleo

ASKER

Sorry folks, I will be away for another week. I'll get back to you after that.
Avatar of leoleo

ASKER

Thanks Michel & CJ. Shall I accept one comment as answer & post another question for the other person?

You can also get Customer Services to split the points, if you wish. Thanks for asking...

Michel
Avatar of leoleo

ASKER

No, I don't want to split points. This question's worth only 50 points. I'll post another question.

:o)
Avatar of leoleo

ASKER

Comment accepted as answer
Avatar of leoleo

ASKER

Thanks again. I am posting another question for CJ with the same amount of points.