日期:2009-12-25  浏览次数:20814 次

假设文章标题字段为title,标签字段为tag 文章表为wz
希望帮助到同样想通过文章标签实现相关文章功能的朋友:

<%
dim kk3,key
kk3=split(mywz("a_tag")," ")
set xgwz=server.CreateObject("adodb.recordset")
for i=0 to ubound(kk3)
key=kk3(i)
bsql=bsql & "artic.a_tag like '%"&key&"%' or "
bsql=bsql & "artic.a_title like '%"&key&"%' or "
next
bsql=Left(bsql,(LEN(bsql)-3))
mysql=" SELECT top 12 * FROM artic WHERE ("&bsql&") order by a_id desc"
xgwz.open mysql,coon,1,3
%>