Hi Sommai.

On Mon, Jun 11, 2001 at 04:52:01PM +0700, Sommai Fongnamthip wrote:
> Dear,
>       I am preparing my web page to display search result.  How could I use SQL 
> command to handle display specific row per page and next button at the 
> bottom page (like most search engine display result).

See the LIMIT clause of the SELECT statement:

<http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SELECT>

That allows you to specify the row offset and the maximum number of
rows to return.  For example:

  SELECT *
    FROM search_results
   WHERE sid = ?
   LIMIT 50,25

That would fetch 25 rows starting at offset 50 (offset is zero-based).

In order to know if you should display the next button, you'll want to
fetch one more row than you need (e.g. if you'll be displaying 25 rows
per page, fetch 26 instead).  If you get that extra row, you'll know you
have more to display.

Maurice

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to