Displaying news across several pages

2003-01-25 Thread Pag

	Hi,

	I am a beginner in this MySQL thing, and i am trying to figure out how i 
can split, for example, some news articles i already have in a table, into 
several pages.

	On the site i am building, i get the 10 first news and display them. I use 
SELECT FROM NEWS ... ORDER BY DATE DESC LIMIT 10. Is there any mysql 
command to select the next 10 items, for example? something like LIMIT 
from 10 to 20 hehe, i know it sounds weird. :-)

	Thanks.

	Pag



-
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: Displaying news across several pages

2003-01-25 Thread Rich Gray
when 2 arguments are specified for LIMIT then the first argument is the
offset and the second is the max number of rows
e.g. below

select * from mytable limit 10,10
select * from mytable limit 20,10

Rich
-Original Message-
From: Pag [mailto:[EMAIL PROTECTED]]
Sent: 25 January 2003 05:10
To: Roger Davis; [EMAIL PROTECTED]
Subject: Displaying news across several pages



Hi,

I am a beginner in this MySQL thing, and i am trying to figure out how i
can split, for example, some news articles i already have in a table, into
several pages.

On the site i am building, i get the 10 first news and display them. I use
SELECT FROM NEWS ... ORDER BY DATE DESC LIMIT 10. Is there any mysql
command to select the next 10 items, for example? something like LIMIT
from 10 to 20 hehe, i know it sounds weird. :-)

Thanks.

Pag



-
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: Displaying news across several pages

2003-01-25 Thread Stefan Hinz, iConnect \(Berlin\)
Pag,

as Rich said:

 select * from mytable limit 10,10
 select * from mytable limit 20,10

In your PHP (?) application, you would have this like:

select * from mytable limit $start,$range

You could set up range (e.g. in config.inc.php) to whatever you want for
the site, and you would add $range to $start when the user clicks on
next, and substract $range from $start when the user clicks on
previous.

HTH,
--
  Stefan Hinz [EMAIL PROTECTED]
  Geschäftsführer / CEO iConnect GmbH http://iConnect.de
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3

- Original Message -
From: Rich Gray [EMAIL PROTECTED]
To: Pag [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, January 25, 2003 12:03 PM
Subject: RE: Displaying news across several pages


 when 2 arguments are specified for LIMIT then the first argument is
the
 offset and the second is the max number of rows
 e.g. below

 select * from mytable limit 10,10
 select * from mytable limit 20,10

 Rich
 -Original Message-
 From: Pag [mailto:[EMAIL PROTECTED]]
 Sent: 25 January 2003 05:10
 To: Roger Davis; [EMAIL PROTECTED]
 Subject: Displaying news across several pages



 Hi,

 I am a beginner in this MySQL thing, and i am trying to figure out how
i
 can split, for example, some news articles i already have in a table,
into
 several pages.

 On the site i am building, i get the 10 first news and display them. I
use
 SELECT FROM NEWS ... ORDER BY DATE DESC LIMIT 10. Is there any mysql
 command to select the next 10 items, for example? something like
LIMIT
 from 10 to 20 hehe, i know it sounds weird. :-)

 Thanks.

 Pag



 -
 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