Koden ser så här ut:
<%
sql = "select * from Annonser where 1 = 1 and accepterad = true"
if not Request.Form("annonstyp") = checked then
sql = sql & " and annonstyp LIKE '%" & Request.Form("annonstyp") & "%' "
end if
if LEN(Request.Form("sok")) > 0 then
sql = sql & " and Rubrik LIKE '%" & Request.Form("sok") & "%' "
end if
if not Request.Form("kategori") = "0" then
sql = sql & " and kategori LIKE '%" & Request.Form("kategori") & "%' "
end if
if not Request.Form("region") = "0" then
sql = sql & " and region LIKE '%" & Request.Form("region") & "%' "
end if
sql = sql & " order by datum DESC "
Set recset = Server.Createobject("ADODB.Recordset")
'***************************************************
Const perSida = 20
If Request.QueryString("page") = "" then
page = 1
Else
page = Request.QueryString("page")
End If
RecSet.CursorLocation = 3
RecSet.CacheSize = perSida
recset.open SQL, "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Database/Annonser.mdb")&""
%>
<%RecSet.MoveFirst
RecSet.PageSize = perSida
TotalPages = RecSet.PageCount
RecSet.AbsolutePage = page
Count = 0
Do While Not RecSet.EOF And Count < RecSet.PageSize %>
<td width="80" height="18"><font size="2" face="Tahoma"> <%=left(recset("Datum"),10)%></font></td>
<td width="44" height="18"><font size="2" face="Tahoma"> <%=mid(recset("Datum"),12,5)%></font></td>
<td width="21" height="18"><%if not recset("bild") = "" then%><font size="2" face="Tahoma"> <img src="Bilder/bild.gif"><%end if%></font></td>
<td width="234" height="18"><font face="Tahoma"><font size="2"> </font><a href="javascript:Annons('visa_annons.asp?annonsid=<%=recset("annonsid")%>','<%=recset("annonsid")%>','scrollbars=yes,width=600,height=550,top=50')"><font size="2"><%=recset("Rubrik")%></font></a></font></td>
<td width="54" height="18"><font size="2" face="Tahoma"> <%if not recset("Pris") = "" then%><%=recset("Pris")%> kr<%end if%></font></td>
<td width="165" height="18"><font size="2" face="Tahoma"> <b><%=recset("kategori")%></b><br>
<%=recset("region")%></font></td>
\</tr\>\<%
Count = Count + 1
recset.movenext
loop
%\>
\</table\>
<img border="0" src="Bilder/genom.gif" width="1" height="6"><%If TotalPages <> 1 Then%>
<tr>
<b><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="590" id="AutoNumber9">
<tr>
<td width="100%" bgcolor="#FFFFFF"><b><font size="2" face="Tahoma" COLOR="#000000"> Sida:</font><font size="1" face="Tahoma">
<%
If TotalPages <> 1 Then
If (Int(page)) <> 1 Then
%>
</font>
<font face="Tahoma" COLOR="#006699">
<a href="sok_annons_visa.asp?page=<%=(Int(page)-1)%>" onFocus="this.blur()">
<font size="1">«
Bakåt</font></a><font size="1"> |
<%Else%><%End If%>
<%
For Pages = 1 To TotalPages
%>
<%If (Int(Pages)) = (Int(page)) Then%> <%=Pages%>
<%Else%>
<a href="sok_annons_visa.asp?page=<%=Pages%>" onFocus="this.blur()"><%=Pages%></a>
<%End If%>
<%Next%>
<%End If%>
<%
If (Int(page)) <> (Int(TotalPages)) Then
%>
|<a onFocus="this.blur()" href="sok_annons_visa.asp?page=<%=(Int(page)+1)%>" COLOR="#FFFFFF"> Framåt »</a>
<%Else%>
<% end if %> </font></td>
</tr>
</table>
<%end if%>
<img border="0" src="Bilder/genom.gif" width="1" height="6"><%else%><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="590" id="AutoNumber10">
<tr>
<td width="100%"><center>
<p><b><font face="Tahoma" >Din sökning gav inga träffar</font></b></p>
</center></td>
</tr>
</table>
<%end if%>
Och jag vill att när man väljer en viss kategori ska det gå att bläddra mellan sidor och titta på ENDAST annonser i denna kategori.
Vad som skal ändras/läggas till ?
