PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Aug 03, 2020 9:53 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Apr 13, 2016 2:31 pm 
Offline
Forum Newbie

Joined: Wed Apr 13, 2016 2:12 pm
Posts: 3
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. :|


Top
 Profile  
 
PostPosted: Wed Apr 13, 2016 3:01 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
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.

_________________


Top
 Profile  
 
PostPosted: Wed Apr 13, 2016 4:40 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US
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)


Top
 Profile  
 
PostPosted: Fri Apr 29, 2016 10:34 am 
Offline
Forum Contributor

Joined: Fri Jul 20, 2007 11:29 am
Posts: 367

_________________
Warning: I have no idea what I'm talking about.


Top
 Profile  
 
PostPosted: Fri Apr 29, 2016 2:30 pm 
Offline
Site Administrator
User avatar

Joined: Wed Aug 25, 2004 7:54 pm
Posts: 13592
Location: New York, NY, US

_________________
(#10850)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group