Søgefunktion - lille detalje !
Hej...Nogle der kan fortælle mig hvordan jeg for resultater frem hvor alle orderne (som kommer via feltet: "words" eks. "dell hurtig surfing") så den søger om den pågældene post i databasen indeholder alle 3 ord..
words = Trim(Request.Form("words"))
words = Replace(words,"'","")
words = Replace(words," "," ")
words = Replace(words," "," ")
words = Replace(words," "," ")
sTempSplit = Split(words," ")
sTempText = ""
iCount = Ubound(sTempSplit)
For i = 0 to iCount
count_words = count_words+1
Next
For i = 0 to iCount
soeg_word = sTempSplit(i)
SQL = "SELECT * FROM alarm_produkt where"
SQL = SQL & " (producent LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (komponentnavn LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (model LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_3 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_4 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_5 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_6 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_7 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_8 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_9 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (notat_10 LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (kort_beskrivelse LIKE '%" & soeg_word & "%')"
SQL = SQL & " OR (produktbeskrivelse LIKE '%" & soeg_word & "%')"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQL, Conn,1, 2
If (rs.BOF Or rs.EOF) AND count_words<>"0" Then
%>Igen poster<%
else
Do While Not rs.EOF
%><%=rs("ID")%><br><%
count_words = count_words-1
rs.MoveNext
Loop
End If
Next
