pagination
Hi,
In my project I am developing pagination concept.
but here problem is data is too large so it takes too much time for fetching data.
so anybody can give me solution like fetching data in some part so reduces data fetching time.
Thanks in advance
himmat.m4
Junior Poster in Training
62 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
Hi,
In my project I am developing pagination concept.
but here problem is data is too large so it takes too much time for fetching data.
so anybody can give me solution like fetching data in some part so reduces data fetching time.
Thanks in advance
If you are using SQL to query in a more conventional manner then have your query in this form:
SELECT * FROM [YOUR DATABASE].[YOUR TABLE] LIMIT 0,70
This would display every piece of data from 1(after 0) to 70.
Depending on how you want to do it, you can then pass the starting position, 0 in this case as a parameter, preferrably as int, whenever you click on "next page" or "previous page".:
//EXAMPLE
//....more code here...
<%
int pager = 0;
String holdPg = request.getParameter("pg");
if(pg!=null){ pager = Integer.parseInt(holdPg) +1;}
//....display data here passing pager as a parameter
//to be included in your SQL query like this at the end: "SELECT ....LIMIT "+pager+",70";
%>
<form id="x">
<input id="pg" name="pg" type="hidden" value="<%=pager%>" />
<input type="submit" name="btnSubmit" value="next page" />
</form>
This is just to give you an idea and not that it's accurate enough to run from a copy-paste mode.That said, I have used this concept for over 2 years now without a hitch.
Hope this helps!
dangari
Junior Poster in Training
73 posts since Aug 2009
Reputation Points: 10
Solved Threads: 3
If you are using SQL to query in a more conventional manner then have your query in this form:
SELECT * FROM [YOUR DATABASE].[YOUR TABLE] LIMIT 0,70
This would display every piece of data from 1(after 0) to 70.
Depending on how you want to do it, you can then pass the starting position, 0 in this case as a parameter, preferrably as int, whenever you click on "next page" or "previous page".:
//EXAMPLE
//....more code here...
<%
int pager = 0;
String holdPg = request.getParameter("pg");
if(pg!=null){ pager = Integer.parseInt(holdPg) +1;}
//....display data here passing pager as a parameter
//to be included in your SQL query like this at the end: "SELECT ....LIMIT "+pager+",70";
%>
<form id="x">
<input id="pg" name="pg" type="hidden" value="<%=pager%>" />
<input type="submit" name="btnSubmit" value="next page" />
</form>
This is just to give you an idea and not that it's accurate enough to run from a copy-paste mode.That said, I have used this concept for over 2 years now without a hitch.
Hope this helps!
Thanks for solution
himmat.m4
Junior Poster in Training
62 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0