Pagination Without Limit in Query

Reply

Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster

Pagination Without Limit in Query

 
0
  #1
Nov 3rd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 525
Reputation: Will Gresham is on a distinguished road 
Solved Threads: 86
Sponsor
Will Gresham's Avatar
Will Gresham Will Gresham is offline Offline
Posting Pro
 
0
  #2
Nov 3rd, 2009
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.
AJAX is not a programming language, scripting language or any other sort of language.
It is acheived by using JavaScript http functions.
So, AJAX = JavaScript.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #3
Nov 3rd, 2009
look around for using SQL_CALC_FOUND_ROWS in query, it may help you
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
0
  #4
Nov 3rd, 2009
hmmmm... how about this logic.. taking whole data set in an array..!! and apply pagination function on it.!!

is this possible..? :O
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #5
Nov 3rd, 2009
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.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
0
  #6
Nov 3rd, 2009
if i can use limit in query then surely i will not create this thread..!!
anyways thanks for reply
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #7
Nov 3rd, 2009
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
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
0
  #8
Nov 4th, 2009
  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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #9
Nov 4th, 2009
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.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 1
Reputation: makgaboe is an unknown quantity at this point 
Solved Threads: 0
makgaboe makgaboe is offline Offline
Newbie Poster
 
0
  #10
Nov 4th, 2009
An array will do for now. But you will need to use limit at some point
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 961 | Replies: 27
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC