In the background to add in general we have set a "keyword", and the general input may be as follows:
Doll, plush doll, Japanese inflatable doll
We will do this according to this, the following specific implementation:
First look at an SQL statement:
Copy Code code as follows:
Select Top 3 sid,sname from product where keywords like '% doll% ' or keywords like '% plush doll% ' or ' keywords like '% Japanese inflatable doll% '
So we can search for products or related articles based on this statement (in fact, there are more complex and better implementations, but this is not mentioned here), here is the key code:
Copy Code code as follows:
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"
%> response.charset= "gb2312"%>
<%
Dim a:a = "doll, plush doll, Japanese inflatable doll"
' obj as value, filed as field name
Function s Qlkeyword (Obj,field)
Dim temp:temp = Split (obj, ",")
for i = 0 To UBound (temp)
Sqlkeyword = Sqlkeyword &A mp field& "like"% &temp (i) & "% ' or"
Next
Sqlkeyword = Left (Sqlkeyword,len (Sqlkeyword)-3)
End F Unction
Dim mysql:mysql = "SELECT Top 3 sid,sname from product where" + Sqlkeyword (A, "keywords")
Respon Se. Write (MySQL)
' Set objRS = objConn.Execute (mysql)
' do as not objrs.eof
' Response.Write (objRS ("sname"))
' Loop
' objrs.close
' Set objRS = Nothing
' objconn.close
' Set objconn = Nothing
% >