SolveErrors
ASP

Pagination to display results of MySQL

67 views

Hi all.

I need your help.

Use this pagination to display results of MySQL, but the link
Code:
Next
is always active even when there are no results to display:


Code:
<%
   pageSize = 25
   
   if(len(Request.QueryString("page"))=0)then
      currentPage = 1
   else
      currentPage = CInt(Request.QueryString("page"))
   end if

   If Not IsNumeric (currentPage) Then currentpage = 1
   If currentPage < 1 Then currentPage = 1

   start = ((currentPage - 1) * pageSize)
   If start < 0 Then start = 0
%>

<% SQL = "SELECT * FROM _myTbl LIMIT " & start & ", " & pageSize %>
<% Set RS = Server.CreateObject("ADODB.Recordset") %>
<% RS.Open SQL, cn %>

<% if Not RS.eof then %>
<% while not RS.eof %>



<% RS.movenext() %>
<% wend %>
<% end if %>
<% RS.Close() : Set RS = Nothing %>

<% if currentPage > 1 then %>
Prev 
<% else %>
Prev<% end if %>
| 
<% if cInt(start) <> cInt(pageSize) then %>
Next
<% else %>
Next
<% end if %>
Hope that helps.
ts

More ASP fixes

IIS: web.config redirect to another url preserving the original one in the address barGet actual URL from address bar in Classic ASP on a 404 redirected pageRequested operation requires a current record.asp guestbook w/ textfileguestbook enties - tutorialsadd asp.net pages to an asp classic website