Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Re: How do they do that? by Maclir
in thread How do they do that? by NodeReaper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2024-03-28 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found