Jump to content

please hel me


cool349

Recommended Posts

can someone plaese help me i have a search engine on my webpage and i want to split the resultpage in a number smaller resultpages this is what i have now:<%'Hieronder kun je het pad naar de database instellendim strConnstrConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db.mdb")'Hieronder vraag je om de twee variabelen die van index.asp komendim strSearchdim strTypestrSearch = request.form("search")strType = request.querystring("type")'Als er geen zoekwoorden ingevuld zijnif request.form("search") = "" thenstrSearch = "Je hebt geen zoekterm ingevuld"end if'Hier vervang je eventuele tekens die als html en commentaar worden gezien'Daar kan index.asp op vastlopenstrSearch = replace(strSearch,"<","")strSearch = replace(strSearch,">","")strSearch = replace(strSearch,"'","''")'Hier declareer je wat variabelen voor laterdim strTitledim strContentdim strSQLdim adoRs'Hier wordt de connectie met de database gemaaktset adoCn = Server.CreateObject("ADODB.Connection")set adoRs = Server.CreateObject("ADODB.Recordset")if request.form("type") = "bloeitijd" thenwhereclause=" where (bloeitijd LIKE '%" & strSearch & "%')"else if request.form("type") = "hoogte" then whereclause=" where (hoogte LIKE '%" & strSearch & "%')" else if request.form("type") = "standp" then whereclause=" where (standp LIKE '%" & strSearch & "%')" else if request.form("type") = "kleur" Then whereclause=" where (kleur LIKE '%" & strSearch & "%')" else whereclause=" where (nl_naam LIKE '%" & strSearch & "%' OR plantnaam LIKE '%" & strSearch & "%')"end ifend ifend ifend if'Hier is de querystring met een whereclause die verderop wordt uitgelegdstrSQL="select * from tbl_content " & whereclause'Hier wordt de recordset geopendadoRS.Open strSQL, strConn, 3'Deze functie is om eventuele html code uit de getoonde zoekresultaten te halen'Daar kan de vormgeving van search.asp op vastlopen%><html><head><title>Hebbink.com - tutorials - Een zoekmachine maken</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body bgcolor="#FFFFFF" text="#000000"><b>Searchresults for: </b><font size="4"><b><%=(strSearch)%></b></font><hr><%'Als er geen resultaten zijn gevondenif adoRs.EOF thenresponse.write("<b>Geen resultaten gevonden..<b><br><br>")end if%><%'Hier begint de loop, zolang er items in de recordset zittenDo While Not adoRs.EOF%><table border="0"> <tr> <td width="70" valign="top"><b><img src="<%=adoRs("thumb")%>" width="80" height="80"></b></td> <td valign="top"><a href="show.asp?id=<%=adoRs("id")%>"><%=adoRs("plantnaam")%></a></td> </tr></table><hr><%'Hier ga je naar het volgende item in de recordsetadoRs.MoveNext Loop%><a href="index.asp">opnieuw zoeken</a></body></html><%'Hier wordt de recordset afgeslotenadoRs.Close set adoRs = nothing%>

Link to comment
Share on other sites

You need to create next and back links that include the search keywords and the page number in the querystring. When they click on the link, you use the keywords to run the search query again, and then use the page from the querystring to figure out how many results to skip before you start showing them.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...