473,699 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pagination Script Problem

1 New Member
I have used the following Pagination script to display database records in a series of pages, but only the first page shows up properly, and on clicking the links of subsequent pages or the NEXT , LAST page links, No records are displayed but only the Message - "Sorry, No records Found!!".shows up.
I guess some form fields values which contain multiple strings with spaces between them are not properly collected into the variables in the ASP Action Page i.e. the page where the records are displayed. Please provide a solution.
The script is given below :
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <%Response.Buffer = True%>
  3. <!---#include file ="config.asp"--->
  4. <% CheckAdmin() 
  5.     action=Request.QueryString("action")
  6.     dim counterstart
  7.       dim counterend
  8.       dim page_size 
  9.       dim cur_page
  10.       dim first_page
  11.       dim pre_page
  12.       dim next_page
  13.       dim last_page
  14.       dim page_count
  15.       page_size = pagesize 
  16.  
  17. 'set Recordset1 = Server.CreateObject("ADODB.Recordset")
  18. 'Recordset1.ActiveConnection = DBPath
  19.  
  20. Dim pageName 'Asp Page Name
  21. Dim Search ' search term duhhh!
  22. Dim Table ' The field that we are searching for
  23. Dim Order ' Sort desc or asc
  24. Dim Person ' Pesonal or web details search
  25. Dim SortOrder
  26. PageName="view_tender.asp"
  27.  
  28. Search = Request.querystring("search")
  29. Table = request.querystring("Table")
  30.  
  31. SortOrder = Request.querystring("SortOrder")
  32.  
  33. If (SortOrder = "") then sortOrder = Table
  34. 'If 
  35. If (Person = "") then Person = "personal"
  36.  
  37. searchby = request.querystring("searchby")
  38. 'Order = request.querystring("order")
  39. Order = "desc"
  40. sortorder ="id"
  41. 'SortOrder = request.querystring("SortOrder")
  42.  
  43. '###### Search Recordset ADAM remember this #######
  44.  
  45. set Recordset1 = Server.CreateObject("ADODB.Recordset")
  46. Recordset1.ActiveConnection = dbpath
  47. if session("lvl")=100 then 
  48.     If Search = "" then 
  49.         If (sortorder = "") then sortorder ="todt"
  50.         Recordset1.Source = "SELECT * FROM tenders ORDER BY "&SortOrder&" "& Order
  51.     Else ' we do a search
  52.         Recordset1.Source = "SELECT * FROM tenders WHERE "&Table&" LIKE '%"&Search&"%' ORDER BY "&SortOrder&" "&Order
  53.     End if
  54. Else
  55.     If Search = "" then 
  56.         If (sortorder = "") then sortorder ="todt"
  57.         Recordset1.Source = "SELECT * FROM tenders WHERE deptId ="& session("deptId") &" ORDER BY "&SortOrder&" "& Order
  58.     Else ' we do a search
  59.         Recordset1.Source = "SELECT * FROM tenders WHERE deptId ="& session("deptId") &" and "&Table&" LIKE '%"&Search&"%' ORDER BY "&SortOrder&" "&Order
  60.     End if
  61. End if
  62.  
  63. 'Recordset1.Source = "Select * from logad"
  64.  
  65. Recordset1.CursorType = 0
  66. Recordset1.CursorLocation = 3
  67. Recordset1.cachesize = 5
  68. Recordset1.LockType = 3
  69. Recordset1.Open
  70. If Err.number <> 0 then
  71.    Recordset1.ActiveConnection.Close 
  72.    Set Recordset1 = Nothing
  73.    checkError()
  74. End if
  75.  
  76. If Recordset1.eof=false then
  77.       Recordset1.PageSize = page_size
  78.       page_count = Recordset1.PageCount
  79.     cur_page= Cint(Request.QueryString("page"))
  80.       if cur_page= "" or cur_page < 1 then
  81.          cur_page = 1
  82.       end if
  83.       Recordset1.AbsolutePage=cur_page
  84.  
  85.  
  86. %>
  87. <html>
  88. <head>
  89. <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
  90. <meta name="ProgId" content="FrontPage.Editor.Document">
  91. <META name="keywords" content="<%=sitekeywords%>">
  92. <META name="language" content="English">
  93. <META name="author" content="Webx">
  94. <META name="copyright" content="Webx">
  95. <META name="robots" content="INDEX, FOLLOW">
  96. <META name="revisit-after" content="10 days">
  97. <META name="document-class" content="Completed">
  98. <META name="document-classification" content="Online Content Management">
  99. <META name="document-rights" content="Copyrighted Work">
  100. <META name="document-type" content="Web Page">
  101. <META name="document-rating" content="Safe for Kids">
  102. <META name="document-distribution" content="Global">
  103. <META name="document-state" content="dynamic">
  104. <META name="cache-control" content="no-cache">
  105. <META name="Abstract" content="Rural Works">
  106. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  107. <title><%=siteTitle%></title>
  108. </head>
  109.  
  110. <body>
  111. <script language="JavaScript">
  112. function ConfirmDelete() 
  113. {
  114.   var confirm_del = window.confirm ("Do you really want to delete?");
  115.   if (confirm_del) 
  116.   {
  117.   document.forms[1].submit();
  118.   }
  119. }
  120.  
  121. function CheckAll(chk)
  122. {
  123. for (var i=0;i < document.forms[1].elements.length;i++)
  124.     {
  125.         var e = document.forms[1].elements[i];
  126.         if (e.type == "checkbox")
  127.         {
  128.             e.checked = chk.checked;
  129.         }
  130.     }
  131. }
  132. </script>
  133. <%if recordset1.eof=false then%>
  134. <div align="center">
  135.   <center>
  136.   <table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="700" id="AutoNumber1" cellpadding="0" height="485">
  137.     <tr>
  138.       <td width="3%">
  139.       <font face="Verdana" size="1">&nbsp;</font></td>
  140.       <td width="94%" colspan="2">
  141.       <font face="Verdana" size="1">&nbsp;</font></td>
  142.       <td width="3%">
  143.       <font face="Verdana" size="1">&nbsp;</font></td>
  144.     </tr>
  145.     <tr>
  146.       <td width="3%" bgcolor="#800000" height="20">
  147.       <img border="0" src="Images/cornerleft.jpg"></td>
  148.       <td width="94%" bgcolor="#800000" height="20" colspan="2">
  149.       <p align="center"><b><font size="2" face="Verdana" color="#FFFFFF">
  150.       Administration Area</font></b></td>
  151.       <td width="3%" bgcolor="#800000" height="20">
  152.       <p align="right">
  153.       <img border="0" src="Images/cornerright.jpg"></td>
  154.     </tr>
  155.     <tr>
  156.       <td width="50%" colspan="2" bgcolor="#800000" height="28">
  157.       <p style="margin-left: 15"><b>
  158.       <font face="Verdana" size="1" color="#FFFFFF">Welcome <%=Request.Cookies("Admin_Name")%></font></b></td>
  159.       <td width="50%" colspan="2" bgcolor="#800000" height="28">
  160.       <p align="right" style="margin-right: 10"><b>
  161.       <font face="Verdana" size="1" color="#FFFFFF"><a href="adminMain.asp">
  162.       <font color="#FFFFFF">Home</font></a> | <a href="LOGOUT.ASP">
  163.       <font color="#FFFFFF">Logoff</font></a> </font></b></td>
  164.     </tr>
  165.     <tr>
  166.       <td width="100%" colspan="4" bgcolor="#EFEFEF" height="36" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#800000">
  167.       <!---#include file ="toplink.asp"--->
  168.       </td>
  169.     </tr>
  170.     <tr>
  171.       <td width="100%" colspan="4" height="344" style="border-style: solid; border-width: 1" bordercolor="#800000" valign="top">
  172.       <table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
  173.         <tr>
  174.           <td width="100%">
  175.           <form method="GET" action="<%=pagename%>">
  176.            <table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber6">
  177.               <tr>
  178.                 <td width="25%"><b><font face="Verdana" size="1">&nbsp;</font></b></td>
  179.                 <td width="25%"><font face="Verdana" size="1">&nbsp;</font></td>
  180.                 <td width="25%"><font face="Verdana" size="1">&nbsp;</font></td>
  181.                 <td width="25%"><font face="Verdana" size="1">&nbsp;</font></td>
  182.               </tr>
  183.               <tr>
  184.                 <td width="25%">
  185.                 <p align="right"><b><font size="1" face="Verdana">Sort By:
  186.                 </font></b></td>
  187.                 <td width="25%">
  188.                 <p align="center"> 
  189.     <select name="table" style="font-size: 8pt; font-family: Verdana; color: #800000">
  190.       <option value="tenderno" selected>Tender No</option>
  191.       <option value="nameWork">Tender Description</option>
  192.       <option value="todt">Opening Date</option>
  193.       <option value="department">Department</option>
  194.     </select></td>
  195.                 <td width="25%"> 
  196.     <input type="text" name="search" size="20" style="font-size: 8pt; font-family: Verdana; color: #800000; border: 1px solid #800000"></td>
  197.                 <td width="25%">
  198.         <input type="submit" value="Search" name="B1" style="font-size: 10pt; font-family: Verdana; color: #FFFFFF; font-weight: bold; border-style: solid; border-width: 1; background-color: #800000"></td>
  199.               </tr>
  200.             </table>
  201.           </form>
  202.           </td>
  203.         </tr>
  204.       </table>
Dec 15 '07 #1
5 1982
jhardman
3,406 Recognized Expert Specialist
continued from above:
Expand|Select|Wrap|Line Numbers
  1.       <table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
  2.         <tr>
  3.           <td width="100%">
  4.       <form method="POST" action="view_tender_action.asp">
  5.         <table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
  6.           <tr>
  7.             <td width="100%" colspan="4" bgcolor="#800000"><b>
  8.             <font face="Verdana" size="1" color="#FFFFFF">&nbsp;Tender&nbsp; Details 
  9.             - All Active Tenders</font></b></td>
  10.           </tr>
  11.           <tr>
  12.             <td width="100%" colspan="4">
  13.             <p align="center"><font face="Verdana" size="1">&nbsp;<font color="#FF0000"><b><%=request.queryString("strErr")%></b></font></font></td>
  14.           </tr>
  15.           <tr>
  16.             <td width="9%" bgcolor="#EFEFEF">
  17.             <p style="margin-left: 15"><font face="Verdana" size="1">&nbsp;<input type="checkbox" name="selectAll" onclick=CheckAll(this) value="ON"></font></td>
  18.             <td width="91%" bgcolor="#EFEFEF" colspan="3"><b><font face="Verdana" size="1">
  19.             &nbsp;Select All</font></b></td>
  20.           </tr>
  21.           <tr>
  22.             <td width="100%" colspan="4"><font face="Verdana" size="1">&nbsp;</font></td>
  23.           </tr>
  24.           <tr>
  25.             <td width="100%" colspan="4">
  26.             <table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber5" height="53">
  27.               <tr>
  28.                 <td width="9%" bgcolor="#800000" height="12">
  29.                 <p align="center"><b>
  30.                 <font face="Verdana" size="1" color="#FFFFFF">Delete</font></b></td>
  31.                 <td width="8%" bgcolor="#800000" height="12"><p align="center">
  32.                 <font face="Verdana" size="1" color="#FFFFFF"><b>&nbsp;Action</font></b></td>
  33.                 <td width="14%" bgcolor="#800000" height="12">
  34.                 <font face="Verdana" size="1" color="#FFFFFF"><b>&nbsp;Issue Date</b></font></td>
  35.                 <td width="13%" bgcolor="#800000" height="12">
  36.                 <font face="Verdana" size="1" color="#FFFFFF"><b>&nbsp;Tender No.</b></font></td>
  37.                 <td width="29%" bgcolor="#800000" height="12">
  38.                 <font face="Verdana" size="1" color="#FFFFFF"><b>&nbsp;Description</b></font></td>
  39.                 <td width="13%" bgcolor="#800000" height="12">
  40.                 <font face="Verdana" size="1" color="#FFFFFF"><b>&nbsp;Due Date</b></font></td>
  41.                 <td width="37%" bgcolor="#800000" height="12">
  42.                 <font face="Verdana" size="1" color="#FFFFFF"><b>&nbsp;Click for Details</b></font></td>
  43.               </tr>
  44.                <%
  45.                linkpage = ""
  46.                do while recordset1.Absolutepage=cur_page and recordset1.Eof = false
  47.                %>
  48.               <tr>
  49.                 <td width="9%" bgcolor="#EFEFEF" height="20">
  50.                 <p align="center"><font size="1" face="Verdana">
  51.                 <input type="checkbox" name="delete" value="<%=(Recordset1.Fields.Item("id").Value)%>"></font></td>
  52.                 <td width="8%" bgcolor="#EFEFEF" height="20">
  53.                 <p align="center"><b><font size="1" face="Verdana">
  54.                 <a href="edit_tender.asp?pg=<%=pagename%>&id=<%=(Recordset1.Fields.Item("Id").Value)%>">
  55.                 <font color="#000000">Edit</font></a></font></b></td>
  56.                 <%tdd=day(Recordset1.Fields.Item("tenderDt").Value)
  57.                   tmm=month(Recordset1.Fields.Item("tenderDt").Value)
  58.                 tyy=Year(Recordset1.Fields.Item("tenderDt").Value)
  59.                 tdate=tdd & "/" & tmm & "/" & tyy
  60.                 %>
  61.  
  62.                 <td width="14%" bgcolor="#EFEFEF" height="20">
  63.                 <p style="margin-left: 5"><font face="Verdana" size="1"><%=tdate%></font></td>
  64.                 <td width="13%" bgcolor="#EFEFEF" height="20">
  65.                 <p style="margin-left: 5"><font face="Verdana" size="1"><%=(Recordset1.Fields.Item("tenderNo").Value)%></font></td>
  66.                 <td width="29%" bgcolor="#EFEFEF" height="20">
  67.                 <p style="margin-left: 5"><font face="Verdana" size="1"><%=(Recordset1.Fields.Item("ShortDesc").Value)%></font></td>
  68.                 <%dd=day(Recordset1.Fields.Item("ToDt").Value)
  69.                 mm=month(Recordset1.Fields.Item("ToDt").Value)
  70.                 yy=Year(Recordset1.Fields.Item("ToDt").Value)
  71.                 tdate1=dd & "/" & mm & "/" & yy
  72.  
  73.                 if isNull(recordset1("tenderPath")) = true or trim(recordset1("tenderPath")) = "" then
  74.                     linkPage="tender_det.asp"
  75.                 else
  76.                     linkPage="tender_details.asp"
  77.                 end if
  78.                 %>
  79.  
  80.                 <td width="13%" bgcolor="#EFEFEF" height="20">
  81.                 <p style="margin-left: 5"><font face="Verdana" size="1"><%=tdate1%></font></td>
  82.                 <td width="37%" bgcolor="#EFEFEF" height="20">
  83.                 <p style="margin-left: 5">
  84.                 <font face="Verdana" size="1">
  85.                 <b>
  86.                 <a href="<%=linkPage%>?id=<%=(Recordset1.Fields.Item("Id").Value)%>">
  87.                 <font color="#000000">Details</font> </a></b></font></td>
  88.               </tr>
  89.                <%
  90.                Recordset1.MoveNext()
  91.                loop
  92.                Recordset1.close()
  93.                Set Recordset1 = nothing
  94.                end if
  95.                %>
  96.                <tr>
  97.                 <td width="9%" bgcolor="#800000" height="12"><font size="1" face="Verdana">&nbsp;</font></td>
  98.                 <td width="8%" bgcolor="#800000" height="12"><font face="Verdana" size="1">&nbsp;</font></td>
  99.                 <td width="14%" bgcolor="#800000" height="12"><font face="Verdana" size="1">
  100.                 &nbsp;</font></td>
  101.                 <td width="13%" bgcolor="#800000" height="12"><font face="Verdana" size="1">
  102.                 &nbsp;</font></td>
  103.                 <td width="29%" bgcolor="#800000" height="12"><font face="Verdana" size="1">
  104.                 &nbsp;</font></td>
  105.                 <td width="13%" bgcolor="#800000" height="12"><font face="Verdana" size="1">
  106.                 &nbsp;</font></td>
  107.                 <td width="37%" bgcolor="#800000" height="12"><font size="1">&nbsp;</font></td>
  108.               </tr>
  109.             </table>
  110.             </td>
  111.           </tr>
  112.           <tr>
  113.             <td width="9%"><font face="Verdana" size="1">&nbsp;</font></td>
  114.             <td width="32%"><font face="Verdana" size="1">&nbsp;</font></td>
  115.             <td width="34%"><font face="Verdana" size="1">&nbsp;</font></td>
  116.             <td width="25%"><font face="Verdana" size="1">&nbsp;</font></td>
  117.           </tr>
  118.           <tr>
  119.             <td width="9%" bgcolor="#EFEFEF">
  120.             <p align="center"><font face="Verdana" size="1">
  121.             <input type="checkbox" name="selectAll1" onclick=CheckAll(this) value="ON"></font></td>
  122.             <td width="91%" bgcolor="#EFEFEF" colspan="3"><b><font face="Verdana" size="1">
  123.             Select All</font></b></td>
  124.           </tr>
  125.           <tr>
  126.             <td width="100%" colspan="4">
  127.             <p align="center"><b><font face="Verdana" size="1"><%call navBar1()%></font></b></td>
  128.           </tr>
  129.         </table>
Dec 17 '07 #2
jhardman
3,406 Recognized Expert Specialist
continued from above:
Expand|Select|Wrap|Line Numbers
  1.         <p align="center">
  2.         <input type="button" value="Delete" name="B1" OnClick="ConfirmDelete()" style="font-size: 10pt; font-family: Verdana; color: #FFFFFF; font-weight: bold; border-style: solid; border-width: 1; background-color: #800000">
  3.         <input type="reset" value="Reset" name="B2" style="font-size: 10pt; font-family: Verdana; color: #FFFFFF; font-weight: bold; border-style: solid; border-width: 1; background-color: #800000"></p>
  4.         <input type="hidden" value="<%=pageName%>" name="pageName">
  5.         </form>
  6.           <p>&nbsp;</td>
  7.         </tr>
  8.       </table>
  9.       </td>
  10.     </tr>
  11.     <tr>
  12.       <td width="45%" colspan="2" height="19" bgcolor="#EFEFEF" style="border-left-style: solid; border-left-width: 1; border-right-style: none; border-right-width: medium; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#800000">
  13.       <p style="margin-left:15; margin-top:0; margin-bottom:0"><b>
  14.       <font size="1" face="Verdana" color="#800000">Admin Module Version 1.0</font></b></td>
  15.       <td width="55%" colspan="2" height="19" bgcolor="#EFEFEF" style="border-left-style: none; border-left-width: medium; border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#800000">
  16.       <p style="margin-right: 15; margin-top: 0; margin-bottom: 0" align="right"><b>
  17.       <font face="Verdana" size="1" color="#800000">Powered By: 
  18.       <a href="http://www.webxindia.com"><font color="#800000">WebX</font></a></font></b></td>
  19.     </tr>
  20.     <tr>
  21.       <td width="100%" colspan="4" height="20" style="border-top-style: solid; border-top-width: 1">&nbsp;</td>
  22.     </tr>
  23.   </table>
  24.   </center>
  25. </div>
  26. <% 
  27. Else
  28. if request.queryString("strErr") = "" then
  29.     DispErr= "Sorry No Records Found!!"
  30. Else
  31.     DispErr = request.queryString("strErr")
  32. End if
  33.  
  34. %>
  35.        <center>
  36.             <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="700" id="AutoNumber7">
  37.               <tr>
  38.                 <td width="20" bgcolor="#800000">
  39.       <img border="0" src="Images/cornerleft.jpg"></td>
  40.                 <td width="660" bgcolor="#800000">
  41.                 <p align="center"><b>
  42.                 <font color="#FFFFFF" size="2" face="Verdana">Information</font></b></td>
  43.                 <td width="20">
  44.                 <p align="right">
  45.                 <img border="0" src="Images/cornerright.jpg"></td>
  46.               </tr>
  47.               <tr>
  48.                 <td width="20" bgcolor="#EFEFEF" bordercolor="#800000" style="border-left-style: solid; border-left-width: 1">&nbsp;</td>
  49.                 <td width="660" bgcolor="#EFEFEF">&nbsp;</td>
  50.                 <td width="20" bgcolor="#EFEFEF" bordercolor="#800000" style="border-right-style: solid; border-right-width: 1">&nbsp;</td>
  51.               </tr>
  52.               <tr>
  53.                 <td width="20" bordercolor="#800000" style="border-left-style: solid; border-left-width: 1">&nbsp;</td>
  54.                 <td width="660">&nbsp;</td>
  55.                 <td width="20" bordercolor="#800000" style="border-right-style: solid; border-right-width: 1">&nbsp;</td>
  56.               </tr>
  57.               <tr>
  58.                 <td width="20" bordercolor="#800000" style="border-left-style: solid; border-left-width: 1">&nbsp;</td>
  59.                 <td width="660">
  60.                 <p align="center"><font size="2" face="Verdana" color="#800000"><b><%=dispErr%></b></td>
  61.                 <td width="20" bordercolor="#800000" style="border-right-style: solid; border-right-width: 1">&nbsp;</td>
  62.               </tr>
  63.               <tr>
  64.                 <td width="20" bordercolor="#800000" style="border-left-style: solid; border-left-width: 1">&nbsp;</td>
  65.                 <td width="660">&nbsp;</td>
  66.                 <td width="20" bordercolor="#800000" style="border-right-style: solid; border-right-width: 1">&nbsp;</td>
  67.               </tr>
  68.               <tr>
  69.                 <td width="20" bordercolor="#800000" style="border-left-style: solid; border-left-width: 1; border-bottom-style: solid; border-bottom-width: 1" bgcolor="#EFEFEF">&nbsp;</td>
  70.                 <td width="660" bgcolor="#EFEFEF" bordercolor="#800000" style="border-bottom-style: solid; border-bottom-width: 1">&nbsp;</td>
  71.                 <td width="20" bgcolor="#EFEFEF" bordercolor="#800000" style="border-right-style: solid; border-right-width: 1; border-bottom-style: solid; border-bottom-width: 1">&nbsp;</td>
  72.               </tr>
  73.             </table>
  74.             <font size="2" face="Verdana"></center>
  75.         <%
  76.             Recordset1.close()
  77.             Set Recordset1 = Nothing
  78.             Response.end 
  79.         end if 
  80. %>
  81. <%sub navBar1()
  82. 'Counter for paging loop
  83.     if(cur_page mod 10)= 0 then
  84.             counterstart = cur_page - 9
  85.         else
  86.             counterstart = cur_page - (cur_page mod 10) + 1
  87.         end if
  88.             counterend = counterstart + 9
  89.  
  90.         if counterend >= page_count then
  91.             counterend=Page_count
  92.         end if
  93.  
  94. 'For Last
  95.     last_page=page_count
  96. 'For next page
  97.     if ( (counterstart + 10) <= page_count )then
  98.       next_page= counterstart + 10
  99.     end if
  100. 'First page
  101.       first_page=1
  102. 'Previous Page
  103.     if counterstart > 10 then
  104.       pre_page = counterstart - 10 
  105.     end if    
  106.  
  107. 'paging string    
  108.     strpage=""
  109.      for k=counterstart to counterend step 1
  110.      if counterstart < page_count or  counterstart = page_count then    
  111.           if k = cur_page then
  112.                 strpage = strpage &"&nbsp;"& k
  113.             else
  114.                 strpage = strpage & "&nbsp;<A href="& pageName &"?table="& table & "&search="& search & "&action=showAll&page="& k 
  115.                 strpage = strpage & ">" & k & "</A>"
  116.           end if
  117.    end if
  118.   next
  119.  
  120.  
  121.   '///////////////////////
  122.   'first
  123.   if  cur_page <> 1 then
  124.     str1="<A href="& pageName &"?table="& table & "&search="& search & "&action=showAll&page=1>First</A>&nbsp;:&nbsp;"
  125.   else
  126.     str1=  "First&nbsp;:&nbsp;"
  127.   end if
  128.  
  129.   'previous
  130.   if counterstart < 10 then
  131.      str1= str1 &"Previous"
  132.   else
  133.     str1= str1 &"<A href="& pageName &"?table="& table & "&search="& search & "&action=showAll&page="& pre_page &">Previous</A>"
  134.   end if 
  135.  
  136. 'Next
  137.   if counterstart+10 < page_count then
  138.       str2="<A href="& pageName &"?table="& table & "&search="& search & "&action=showAll&page="& next_page &">Next</A>&nbsp;:&nbsp;"
  139.   else
  140.       str2="Next&nbsp;:&nbsp;"
  141.   end if    
  142. 'Last
  143.   if cur_page < page_count then
  144.     str2=str2 &"<A href="& pageName &"?table="& table & "&search="& search & "&action=showAll&page="& last_page &">Last</A>"     
  145.   else
  146.     str2= str2 &"Last"
  147.   end if
  148.   '///////////////////////
  149.  
  150.   'Response.Write "<table width=98% cellpadding=4 cellspacing=1 bgcolor=#663333 >"
  151.   'Response.Write"<tr><td align=right bgcolor=#ffffff >"
  152.   'Response.Write "<FONT face='Verdana, Arial, Helvetica, sans-serif'color=#663333 size=2>"  
  153.   Response.Write str1 & " [ " & strpage & " ] " & str2 &"</font>&nbsp;&nbsp;"
  154.   'Response.Write"</td></tr></table>"
  155.  
  156.   end sub%>
  157.  
  158. </body>
  159.  
  160. </html>
Dec 17 '07 #3
jhardman
3,406 Recognized Expert Specialist
you just posted almost 500 lines of code. There is no way I am going to read through it to try to find a problem. Shorten it down to 50 lines and a bunch of psuedo-code and I will look into it.

Jared
Dec 17 '07 #4
Nicodemas
164 Recognized Expert New Member
I have a pretty neat piece of VBScript that will page out a resultset using GetRows available for download off my website. Go to The Projects and look for the link there.
Dec 18 '07 #5
jhardman
3,406 Recognized Expert Specialist
I have a pretty neat piece of VBScript that will page out a resultset using GetRows available for download off my website. Go to The Projects and look for the link there.
Interested in writing it down in "how-to" article format? this question comes up often enough.

Jared
Dec 18 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2402
by: leegold2 | last post by:
Hi, I have been looking around for a way to paginate php/mysql table output. There are a lot of hits when I google it. But unfortunately what I have tried either does not work or is imho just arcane code. So I am looking for a simple, clearly explained, and working pagination code snip that I can adapt, or a modular solution. I'd prefer something you have tried yourself and know it works. The simpler the better. Thanks very much.
2
2322
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't functioning or the $page variable isnt working in that part of the code... Below is the link to the working but broken page.. as well as the main part of my code... Hopefully someone can explain why the operators arent working or maybe see what i...
1
7407
by: dhanu | last post by:
How to manage pagination in AJAX? My requirement is similar to GMails inbox feature. Whenever a new mail comes in,the newly arrived mail is at the start of my inbox and last row in that page goes to next page(ie Pagination happens automatically without any page refresh). I have used ajaxdisplay tag library from Source Forge which does pagination but doesnot suffice my requirement.ie Whenever a new record is added then it should also be...
1
3224
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed and reaches a specific length, it terminates printing that page, prints a page number, and then begins to print the next page using the same header and format as the previous page. The page uses no tables or paragraph elements, only CSS. IOW, I...
4
3644
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed and reaches a specific length, it terminates printing that page, prints a page number, and then begins to print the next page using the same header and format as the previous page. The page uses no tables or paragraph elements, only CSS. IOW, I...
3
6397
Unicron
by: Unicron | last post by:
Hi folks, I have been working on a property listing search for a company for a while now and have hit a roadblock. I have searched the net up and down. A lot of Google results lead to this site, but I have never been able to get it to work. Here's the setup- The user submits search criteria via POST. The results php page pulls the $_POST array and displays the results with pagination of 20 results per page with links for Next/Previous. ...
1
6847
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that i have written for pagination but it displays the link of all the pages at one go i.e. if i have 8 pages showing 10 results per page than it shows links for all 8 pages. Previous 1-10 11-20 21-30 31-40 41-50 51-60 61-70 71-80 Next i want to...
2
2136
by: mac | last post by:
Hi, I'm looking for a script that will allow me to upload images to a folder and shows pagination... pls can any body help me? i hav done with the uploading, but not able to do with the pagination...here is the upload code..
16
2772
by: gnawz | last post by:
I have a pagination function I am using in a file called functions.php as below<? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET) && (int)$_GET > 0) { $page = (int)$_GET; } else { $page = 1; } // start fetching from this row number $offset = ($page - 1) * $itemPerPage; return $sql . " LIMIT $offset, $itemPerPage"; } /* Get the links to navigate between...
0
8631
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8945
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7787
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5889
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4392
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4641
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2366
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.