相关文章

思路篇

2008-07-09 15:22

给文章加一个 TAG 字段

根据TAG 字段的值

在数据库里搜索

function tags(str,id)

if len(trim(str))=0 then            '如果为空值
response.Write("没有相关新闻!")
else

Set rs = Server.CreateObject("ADODB.Recordset")      '不显示本文章的ID
sql="select top 8 * from [info] where   tag='"&str&"' and id<>"&id&" order by top1 desc,id desc"
rs.open sql,conn,1,1
response.Write("<table width='90%' cellpadding='0' cellspacing='0' border=0 class='blue12'>")
if not rs.eof then

do while not rs.eof
response.Write("<tr><td width=50></td><td> ")
response.Write("<a href='/news.asp?id="&rs("id")&"' title='"&rs("bt")&"' target='_blank'>· ")
response.Write(rs("bt"))

response.Write("&nbsp;&nbsp;[")

a=split(rs("fbsj")," ")
response.Write(a(0))
response.Write("]</a>")
response.Write("</td></tr>")

rs.movenext
loop
else
response.Write("<td>没有相关内容!</td>")
end if
response.Write("</table>")
rs.close
set rs=Nothing
end if
end function