Re: LIMIT?

From: Date: Mon, 06 Feb 2006 14:54:01 +0000
Subject: Re: LIMIT?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-229948@lists.php.net to get a copy of this message
I have a news page which is getting quite long now and I would like to split the news to two pages. Now I have one SQL query for all the rows and I think I could use LIMIT to limit the results but how to limit the results for example to 15 rows for page one and from 16 to the last on second page? Number of rows increase daily. One page one there's headline and short summary and the second page should be "archive" with only the headline so all remaining rows can be printed to one page. Something like: "SELECT * FROM x_news LIMIT 0 , 15" but how to do the archive page SELECT * FROM x_news LIMIT 16 , xx?
What you're describing is called "pagination". There are examples online. Basically you just need to pass to the second (and other) pages the LIMIT values (16 and xx above). Larry

« previous php.general (#229948) next »