Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: How do they do that?

by Maclir (Curate)
on Mar 27, 2002 at 23:48 UTC ( #154847=note: print w/ replies, xml ) Need Help??

in reply to How do they do that?

Well, I don't know how individual programmers who implemented the various search engines would do it, but, having implemented similar functions before, this is the way I would approach it.

  1. Assume your search process uses a database. The person posing the search provides the search terms, and your program formulates a SQL query based on those terms. One option in SQL is the "COUNT" option, which returns the number of records in the database matching the query. This number would be placed in the "number of matches" part of the page.
  2. To control pagination, (how many records to display on each page), you have a program variable, say $records_per_page that is either a constant value (everyone sees 20 records per page), or user configurable. You then need to keep track of what "page" you are about to show. and for each page you will display from record ($page_number - 1) * $records_per_page. SQL fetch nexts can be used to get successive records.
  3. Finally, since we are talking web pages here (are we?), you need to preserve state between sessions. There is lots of information on this site (and others) on how to do that.

Comment on Re: How do they do that?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://154847]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2014-09-20 10:34 GMT
Find Nodes?
    Voting Booth?

    How do you remember the number of days in each month?

    Results (158 votes), past polls