목적 : 기사 테이블의 쿼리 기사 키워드
Query 형식 : Baidu Google Baidu는 더 좋거나 Google이 더 좋습니다. Baidu + Google (조건을 입력하지 않고도 쿼리 할 수도 있습니다).
<!-#includefile = "conn.asp"->
<%
functionsearshsql (tname, lname, str) 'tname-table namelname-column namest-query 문자
iftrim (str) = ""그런 다음
mysql = "select*from"& tname
또 다른
str = sqlencode (str) '전처리 쿼리 문자열
arrstr = split (str, "") '문자열은 공백으로 처리됩니다
umax = ubound (arrstr) '세분화 후 배열이 나뉘어지고 나누어진 키워드 수를 결정합니다.
"ifumax> 0then"키워드에서 여러 공간의 ifumax> 0then '처리는 두 번째 차원에서 시작됩니다.
fori = 1toumax
strtemp = arrstr (i)
iftrim (strtemp) = ""thenstrtemp = "/~~~~~/" '요소가 비어 있고 특수 문자로 대체됩니다.
sql = sql & "또는"& lname & "like '%"& strtemp & "%'"
다음
endif
mysql = "select*from"& tname & "where"& lname & "like '%"& arrstr (0) & "%'"& sql
하다
j = instr (1, mysql, "%/~ ~~~~/%", 1)
ifj = 0then
exitdo
endif
mysql = replace (mysql, "또는"& lname & "like '%/~~~~~/%'", "")