Re: Limit items per page like in Altavista.
| From: | Joe Sheble aka Wizaerd | Date: | Thu, 31 Aug 2000 14:16:41 +0000 |
| Subject: | Re: Limit items per page like in Altavista. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-14615@lists.php.net to get a copy of this message | ||
At 06:28 PM 8/30/00, you wrote:
On Thu, Aug 31, 2000 at 01:59:52PM +0900, Maxim Maletsky wrote: Hi! One of my script is getting data from mySQL database and then lists it all on one page with loop, What I need is to create a limit, let's say 10 items per page, then if we got more then 10 items a link on the bottom will say: page2, page3, page4.. etc basing on the amount of items existing there. I needed to do the same thing and ended up using the code at www.phpbuilder.com. The script needed a small tweak (The first row of data is 0, not 1 in MySQL) but asside from that was stright forward enough to use. You'll find it in the DB section under the Columns link.I've not had any difficulties in setting up next and previous links for pages that display 10 or 20 records from a database. Each of the records is nothing more than a summmary listing of records, and they are links which goes to a page and shows detail from that very record. What I'd like to do is in the details page though is display a Next and Previous link or button that would go to the next or previous detail record. If the main display holds 10 records and I click the 10th record, how do I determine what the next detail record to display is, or if I'm several pages in and click the top record, how do I determine what the previous record would be? AT one point I was loading all the IDs in an array, then using the array to determine what the previous and next detail record was, but as the database grew, load times on the page was increasing because of pulling those IDs. BTW, these records change their order all the time based on a timestamp field, so when you actually display the detail record, what would've been the previous record may not be the previous record anymore because somebody else modified a record while you were viewing that particular detail record