诚望指教
<%openproductnews
dim totalart,Currentpage,totalpages,j,colname,cid,key,temp,cid1,mdim,depth,spacebar
nummer=40
cid=request("c_id")
key=request("keyword")
action=request("action")
if request("c_id")<>"" then
sql="select * from class where cid="&request("c_id")
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
mdim=""
depth=rs("depth")
temp=""
sql="select * from class where depth>="&depth
set rs1=server.createobject("adodb.recordset")
rs1.open sql,conn,1,1
do while not rs1.eof
temp=split(rs1("id_code"),",")
if cid=temp(depth) then
if mdim="" then
mdim=rs1("cid")
else
mdim=mdim&","&rs1("cid")
end if
end if
rs1.movenext
loop
mdim=split(mdim,",")
spacebar=" "
sql="("
for i=0 to ubound(mdim)
if i<>ubound(mdim) then
spacebar=" or "
else
spacebar=" "
end if
sql=sql&"cid="&mdim(i)&spacebar
next
sql=sql&" ) and depth>="&depth&" "
end if
if request("keyword")<>"" then
if sql<>"" then
'sql=sql&"where name like '%"&key&"%' or content like '%"&key&"%'"
sql=sql&" and name like '%"&key&"%' "
else
sql= " name like '%"&key&"%' "
end if
end if
if sql <>"" then
sql="select * from news where "&sql&" order by id desc"
else
sql="select * from product order by id desc"
end if
pageurl="?c_id="&cid&"&s_id="&sid&"&action="&action&"&keyword="&key&"&"
session("pageurl")="?c_id="&cid&"&s_id="&sid&"&action="&action&"&keyword="&key&"&"
'response.Write sql
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
rssum=rs.recordcount
end if
call format_pagecute("2")
if not rs.eof then
temp=split(rs("id_code"),",")
aspname=int(temp(0))
sql="select * from class where cid="&aspname
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
end if
%>
数据库openproductnews有两个表分别为class和news
class有字段(cid,pid,cname,depth,cid_order,id_code)
news有字段(id,cid,name,pic,content,depth,depth,id_code,pro_date,cid_order等)
上面的程式是用(?=)取得数据,如果我想在首页或者没有(?=)的情况下取得数据并显示,程式该如何写?
(比如在首页上显示最近上传的五条新闻的标题并链连)
本人门口水平,请各位指教!