看例:
<%
d="求一个好一点的算法"
ln=len(d)'分割所有字符查找相匹配的
for i=1 to ln'循环分割
ss=mid(d,i,1)
bbb=ss
for b=1 to ln-1
cc=mid(d,i+1,"1")
next
aaa=cc
b=bbb+aaa'分割后再进行组合
for ii=1 to len(b)-1'分割后取两个字
Set Rs=server.createobject("ADODB.recordset")
Rs.open "select * from info Where name like '%"&b&"%' or note like '%"&b&"%' Order By Id Desc",conn,1,1'数据在表中查询
if not rs.eof then
rs.pagesize=10
page=CLng(Request.QueryString(("page")))
if page<1 then
page=1
end if
rs.absolutepage=page
for iii=1 to rs.pagesize
%>
<div id="article">
<div class="sou">
<div class="title"><a target="_blank" href="<%=Rs("address")%>"><%=Rs("name")%></a>
</div>
<div class="content"><%=left(Rs("note"),100)%>......</div>
<div class="addr"><%=Rs("address")%><a target="_blank" style="color:#999999; text-decoration:none" href="http://www.baidu.com/s?tn=ylmf_1_pg&ct=0&ie=gb2312&bs=<%=Server.URLEncode(Rs("name"))%>site%3Abaike.baidu.com&sr=&z=&cl=3&f=8&wd=<%=Server.URLEncode(Rs("name"))%>">进入百度搜索</a></div>
</div>
</div>
<%
rs.movenext
If Rs.Eof Then
Exit For
end if
next
end if'对应if not rs.eof then
next
next
if page>1 then
for m=1 to rs.PageCount'这里需要将分割后的数组输出的数据分页相加能得到页总数,不会@_@请指点。
Response.Write "<a href=?search="
Response.Write"&page="&i&">["&i&"]</a> "
next
Rs.close
set Rs=nothing
%>