944,154 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1998
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 3rd, 2009
0

Pagination Without Limit in Query

Expand Post »
is there any way to paginate the page without using limit in Query..!!
Actually i m working on predefined stored procedures. and i m not allowed to make in changes that..!!! and that does contain limit function at all..!!!!

any suggestions how should i do it.?

thanks in advance
Last edited by sam023; Nov 3rd, 2009 at 5:40 am.
Similar Threads
Reputation Points: 11
Solved Threads: 6
Junior Poster
sam023 is offline Offline
164 posts
since Jun 2009
Nov 3rd, 2009
0
Re: Pagination Without Limit in Query
Surely pagination without a limit would not be pagination...

The limit is there to specify how many results are retreived, without it all records would be pulled on each query.
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008
Nov 3rd, 2009
0
Re: Pagination Without Limit in Query
look around for using SQL_CALC_FOUND_ROWS in query, it may help you
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 3rd, 2009
0
Re: Pagination Without Limit in Query
hmmmm... how about this logic.. taking whole data set in an array..!! and apply pagination function on it.!!

is this possible..? :O
Reputation Points: 11
Solved Threads: 6
Junior Poster
sam023 is offline Offline
164 posts
since Jun 2009
Nov 3rd, 2009
0
Re: Pagination Without Limit in Query
so whats the need to do this, anyways you fetching the entire data and storing it to some array, it will consume lots and lots of memory.Better to use the MySQL query with the limit.
You can cache the result coming each time for some predefined time duration.It will help to make the results faster.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 3rd, 2009
0
Re: Pagination Without Limit in Query
if i can use limit in query then surely i will not create this thread..!!
anyways thanks for reply
Reputation Points: 11
Solved Threads: 6
Junior Poster
sam023 is offline Offline
164 posts
since Jun 2009
Nov 3rd, 2009
0
Re: Pagination Without Limit in Query
why you cant use the limit in query, just post your code and the problem it creates when used the limit.
I am sure there is some misconception about some patch of code
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: Pagination Without Limit in Query
mysql Syntax (Toggle Plain Text)
  1. DELIMITER $$
  2.  
  3. DROP PROCEDURE IF EXISTS `dd`.`view_ratecard`$$
  4.  
  5. CREATE DEFINER=`root`@`localhost` PROCEDURE `view_ratecard`(id_tariffplan INT(11),country_code CHAR(30))
  6. BEGIN
  7. if(country_code="") THEN
  8. SELECT dialprefix,destination,rateinitial,initblock,billingblock,id_trunk,grace,idtariffplan,id FROM
  9. cc_ratecard WHERE idtariffplan=id_tariffplan AND rate_version='0' ORDER BY destination asc;
  10. ELSE
  11. SELECT dialprefix,destination,rateinitial,initblock,billingblock,id_trunk,grace,idtariffplan,id FROM
  12. cc_ratecard WHERE idtariffplan=id_tariffplan AND rate_version='0' AND dialprefix LIKE CONCAT(country_code,'%') ORDER BY destination asc;
  13. END if ;
  14. END$$
  15. DELIMITER ;
its a simple store procedure..!!! which returns more than 150 records..!! the same procedure is used by our .Net department..!! and they dont need limit in Query at all..!
Last edited by sam023; Nov 4th, 2009 at 1:10 am.
Reputation Points: 11
Solved Threads: 6
Junior Poster
sam023 is offline Offline
164 posts
since Jun 2009
Nov 4th, 2009
0
Re: Pagination Without Limit in Query
It is always nice to have one SP against such queries which get fired often.Ok, they told you to implement the same SP as it is and you are worried about the pagination.You can proceed the way you want like gettign everything in entire array, if you are sure that, the rows returned by that SP are not much.
Or else you can modify the same simple SP to accept the start index and the page_size for making pagination easier.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: Pagination Without Limit in Query
An array will do for now. But you will need to use limit at some point
Reputation Points: 10
Solved Threads: 0
Newbie Poster
makgaboe is offline Offline
1 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: send html form as mail attachment in php
Next Thread in PHP Forum Timeline: stop playing 4 10 sec while buffer mp3 file?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC