Jag använder mig av detta paging skript som jag hittat här och det fungerar hur bra som helst när jag listar tio recept per sida, men nu tänkte jag göra en typ av sitemapp över mina recept och lista 75 på vardera sida. Det fungerar bra på första sidan men på sida två så börjar det lista från recept 11 och uppåt istället för recept 76 och uppåt och sidan 3 från recept 21 och uppåt istället för 151 som jag vill.
Dim objConn5, strSQL5, forRS5, intPage5, intCount5
If FixqueryInject("mat") = "" OR IsNumeric(FixqueryInject("mat")) = False Then
intPage5 = 1
Else
intPage5 = Int(CInt(FixqueryInject("mat")))
End If
Set objConn5 = Server.CreateObject("ADODB.Connection")
objConn5.Open MM_test_STRING
strSQL5 = "SELECT receptnr, rec_namn1, instr_1, bildliten, beskrivning FROM recept ORDER BY rec_namn1 ASC"
Set forRS5 = Server.CreateObject("ADODB.Recordset")
forRs5.cursorlocation = 3
forRS5.Open strSQL5, objConn5
If forRS5.EOF Then
else
With forRS5
.AbsolutePage = intPage5
.PageSize = 75 'Ändra 10 till så många poster du vill ha per sida.
End With
Do Until forRS5.EOF OR intCount5 = forRS5.PageSize
With Response
.Write ("<div class=""sokwrapper""><A HREF='recept.asp?receptnr=" & forRS5("receptnr") & "'>Se hela receptet på " & forRS5("rec_namn1")& "</a><br>"&(sBild3(forRS5("instr_1")))&"</div>")
End With
forRS5.MoveNext
intCount5 = intCount5 + 1
Loop
response.Write ("<p>")
If forRS5.PageCount > 1 Then
If intPage5 > 1 Then
Response.Write("<b><a href=""alla-recept.asp?mat=1"&""">Första"&"</a></b> ")
End If
For i = 1 To forRS5.PageCount
If i <> intPage5 Then
Response.Write("<b><a href=""alla-recept.asp?mat=" & i & " "">" & i & "</a> </b>")
Else
Response.Write(i & " ")
End If
Next
If intPage5 < forRS5.PageCount Then
Response.Write("<b><a href=""alla-recept.asp?mat=" & forRS5.PageCount &""">Sista</a></b> ")
End If
End If
end if
forRS5.Close : Set forRS5 = Nothing
objConn5.Close : Set objConn5 = Nothing