<%
Dim con, rs, sql, aLinks, i
REM connect to our database
Set con = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
con.Provider = "Microsoft.Jet.OLEDB.4.0"
REM Change the database path to reflect the actual path on your server, from the root folder
con.Open "Data Source = " & Server.MapPath("\database\database.mdb")
REM order our links by the number of hits in, like any good toplist
sql = "Select ID, link, description, hits_in, hits_out From links Where category = '" & Request.Querystring("category") & "' Order By hits_in DESC"
Set rs = con.Execute(sql)
REM Put our categories in an array
aLinks = rs.GetRows
REM Close our connection/database
Set rs = Nothing
con.Close
Set con = Nothing
REM Display our links
For i = 0 to UBound(aLinks, 2)
Response.Write ((i + 1) & ". <a href=""out.asp?ID=" & aLinks(0, i) & """ target=""_blank"">" & aLinks(1, i) & "</a><br />" & _
" " & aLinks(2, i) & "<br />In: " & aLinks(3, i) & "<br />Out: " & aLinks(4, i) & "<br /><br />")
Next
%>