plasterx
11-30-2005, 02:18 AM
hi guys,i've got another problem now - paging .. it just isn't working correctly. Thing is,i set the page limit to 6,means displaying only 6 records per page but somehow it's displaying everything on one page!
here's my code...
request.QueryString("page")
If curpage = "" then curpage = "1"
max = 5
rec = curpage * max
SQL = "select * from slicecakes"
rs.open sql,conn, 3,3
rowcount = 0
pgSize = max * (curpage - 1)
while not rs.eof
<tr>
<td><%=rs("slicecode")%></td>
<td><%=rs("Slicename")%></td>
<td><%=rs("sliceprice")%></td>
</tr>
rowcount = rowcount + 1
rs.movenext
wend
rs.close
SQL = "select count (*) from slicecakes "
rs.open sql,conn,3,3
counter = rs(0)
rs.close
totalpg = int(counter/max)
if counter mod max <> 0 then totalpg = totalpg + 1
for i=1 to totalpg
if Cstr(i)= curpage then
<%=i%>
else
<a href="slicecakes.asp?page =<%=i%>"></a>
end if
next
set conn = nothing
actually i guess i'm missing out some codes to complete the paging..not sure why i set max = 5 but yet everything came out ? i have a total of 21 records,and yes it's displaying 5 pages which is correct (the links ie. the "i") .
What's wrong ???? Some one pls help me take a look at it ....
here's my code...
request.QueryString("page")
If curpage = "" then curpage = "1"
max = 5
rec = curpage * max
SQL = "select * from slicecakes"
rs.open sql,conn, 3,3
rowcount = 0
pgSize = max * (curpage - 1)
while not rs.eof
<tr>
<td><%=rs("slicecode")%></td>
<td><%=rs("Slicename")%></td>
<td><%=rs("sliceprice")%></td>
</tr>
rowcount = rowcount + 1
rs.movenext
wend
rs.close
SQL = "select count (*) from slicecakes "
rs.open sql,conn,3,3
counter = rs(0)
rs.close
totalpg = int(counter/max)
if counter mod max <> 0 then totalpg = totalpg + 1
for i=1 to totalpg
if Cstr(i)= curpage then
<%=i%>
else
<a href="slicecakes.asp?page =<%=i%>"></a>
end if
next
set conn = nothing
actually i guess i'm missing out some codes to complete the paging..not sure why i set max = 5 but yet everything came out ? i have a total of 21 records,and yes it's displaying 5 pages which is correct (the links ie. the "i") .
What's wrong ???? Some one pls help me take a look at it ....