Paging på søgeside
Hvad gør jeg galt ??Søgeresultatet kommer rigtigt frem med angivelse af antal sider, MEN når jeg går til side 2 eller en anden side hender den alle poster og laver sideantallet om ??
Her er koden !<html><head>
<title>Forhandlere</title>
</head><BODY BGCOLOR="#ffffff" background="giffer/backmain1.gif" text="" link=""
vlink="" alink="" #0000a0"" #0000a0"" #0000a0"" #0000a0"">
<center>
<%
intPage = Request("page")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
Set rs = Server.CreateObject("ADODB.RecordSet")
strSQL = "SELECT ID, Navn, Adresse, Postnr, Bynavn, Telefon, Beskrivelse FROM forhandler2 WHERE"
strSQL = strSQL & " (Postnr LIKE '" & request.form("sog") & "%')"
strSQL = strSQL & " ORDER BY Postnr"
strDSN = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&Server.MapPath("../log/search.mdb")
rs.Open strSQL, strDSN, 1, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 4
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
Response.Write "<p><b>Side " & intPage & " af " & intPageCount & "</b></p>"
Do While Not rs.EOF And intRecCount > 0
Response.Write "<font size=5 face=Tahoma><strong>"
Response.Write rs("Navn")
Response.Write "</STRONG>" & "</font>" & "<br>"
Response.Write "<table width=400>"
Response.Write "<valign=top>"
Response.Write "<tr>"
Response.Write "<td width=100>"
Response.Write" <img src="
Response.Write rs("id")
Response.Write ">" & "</td>"
Response.Write "<td width=300 valign=top>"
Response.Write rs("adresse") & " • " & rs("Postnr") & " " & rs("Bynavn") & "<br>"
Response.Write rs("Telefon") & " • " & " • " &rs("Beskrivelse") & " " & rs("ID")
Response.Write "</td>"
Response.Write "</tr>"
Response.Write "</table>"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Response.Write "<p>Gå til side "
For intNum = 1 To intPageCount
Response.Write "<a href=searchcli.asp?page=" & intNum & ">" & intNum & "</a> "
Next
Response.Write "<p>"
If Clng(intPage) > 1 Then
Response.Write "<a href=searchcli.asp?page=" & intPage - 1 & " ><img src=giffer/vpil.gif border=no></a>"
Else
Response.Write "<img src=giffer/blankpil.gif>"
End If
Response.Write " "
If Clng(intPage) < Clng(intPageCount) Then
Response.Write "<a href=searchcli.asp?page=" & intPage + 1 & " ><img src=giffer/hpil.gif border=no></a> "
Else
Response.Write "<img src=giffer/blankpil.gif>"
End If
%>
<p align="center></p>
</body></html>