Re: query to display per page

2001-06-11 Thread Maurice Aubrey

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:



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




Re: query to display per page

2001-06-11 Thread Leon Mergen

In PHP, I used something like this:

query("select * from table limit $x,25");
while ($row=$db->fetch_array($result))
{
echo $row[column];
}
$next = ($x+25);
echo "Next\n";
?>

So that's the idea...

Leon Mergen
[EMAIL PROTECTED]
President of Operations
BlazeBox, Inc.
T: +31 31 735 03 03
F: +31 31 735 03 08
ICQ: 55677353


The information transmitted in this email is intended only for the
person(s)or entity to which it is addressed and may contain confidential
and/or privileged material. Any review, retransmission, dissemination or
other use of, or taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is prohibited. If you
received this email in error, please contact the sender and permanently
delete the email from any computer.
- Original Message -
From: "Sommai Fongnamthip" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 11, 2001 11:52 AM
Subject: query to display per page


> 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).
>
> Sommai Fongnamthip
>
> Remark: Could I use this SQL command with PHP or perl?
>
>
> -
> 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
>
>


-
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




RE: query to display per page

2001-06-11 Thread Simon Green

Try Limit 10,10 then Limit 20,10 or is it the other was around limit 10.20!
Well some thing like that..
Hope this helps

Simon

-Original Message-
From: Sommai Fongnamthip [mailto:[EMAIL PROTECTED]]
Sent: 11 June 2001 10:52
To: [EMAIL PROTECTED]
Subject: query to display per page


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).

Sommai Fongnamthip

Remark: Could I use this SQL command with PHP or perl?


-
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

-
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




query to display per page

2001-06-11 Thread Sommai Fongnamthip

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).

Sommai Fongnamthip

Remark: Could I use this SQL command with PHP or perl?


-
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