
Exploring library package for a beginner programmer?
Moderator: General Moderators
Exploring library package for a beginner programmer?
So I am working on project and I need to apply pagination to it what I am facing is the choice whether I should develop my own code or should I study the pagination library of Laravel I admit the ideal thing would be to first develop it on my own to see how it works but the issue is that I am at a deadline in training period and I have to learn to explore libraries to develop market oriented apps. So would someone kindly recommend me. 

Re: Exploring library package for a beginner programmer?
I'd do it yourself for the learning experience. Pagination isn't that hard, really. Total items / items per page is your page count. Current page * items per page is your offset. Beyond that it's really just a SELECT statement.
- Christopher
- Site Administrator
- Posts: 13592
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Exploring library package for a beginner programmer?
If it is data in a database, you may need to SELECT COUNT(*) WHERE ... first to get the total records, and then SELECT * WHERE ... LIMIT to get a page worth.
(#10850)
-
- Forum Contributor
- Posts: 367
- Joined: Fri Jul 20, 2007 11:29 am
- Contact:
Re: Exploring library package for a beginner programmer?
But only if you need to show the total and/or a list of links to go to each page of results. When you have a huge amount of records it might be best to stick to previous and next links and avoid the extra query.Christopher wrote:If it is data in a database, you may need to SELECT COUNT(*) WHERE ... first to get the total records, and then SELECT * WHERE ... LIMIT to get a page worth.
Warning: I have no idea what I'm talking about.
- Christopher
- Site Administrator
- Posts: 13592
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Exploring library package for a beginner programmer?
This depends on the database. Some databases do not have to scan all records to return a row count. Also, this operation only needs to be performed once when entering the paginated set. Thereafter, it can be passed as a parameter or held in the session.thinsoldier wrote:But only if you need to show the total and/or a list of links to go to each page of results. When you have a huge amount of records it might be best to stick to previous and next links and avoid the extra query.
(#10850)