注册 登录
编程论坛 ASP技术论坛

如何调用不同的ID

lquvfhp 发布于 2010-08-12 11:28, 934 次点击
如何调用不同的ID(就是这个意思。有两个栏目,我需要在首页调用这两个栏目的文章,在一个框中显示,在这两个栏目中只要有新的文章添加,首页都会出现)如何实现这点呢?是在一个表里面,比如说一个ID是4 一个ID是5, 这个代码该怎么写?谢谢。不知道大家理解了没有。
7 回复
#2
孤独冷雨2010-08-12 14:40
是两个栏目在一个表里是吧?这两个栏目肯定在表里有一个字段来区别它们的。比lm字段里0代表栏目一,1代表栏目二。
sql="select * from table where (lm=0 or lm=1) order by id desc"
#3
lquvfhp2010-08-13 12:03
两个栏目是在一个表里面 前台调用的一个栏目。
<%indexget.newslist12 16,4,5,"·","szgr_content.asp",""%> 4就是一个代表一个栏目 我想调用4和15这个该怎么写呢?

下面就是 newslist12
"function newslist12(nlen,classid,nnum,npic,nurl,ntype)
        if ntype="" then
            sql = "Select top "&nnum&" * from art where cat_id="&classid&" order by istop desc, isbest desc, customorder asc, art_id desc"
        else
            sql = "Select top "&nnum&" * from art where cat_id="&classid&" and mytype="&ntype&" order by istop desc, isbest desc, customorder asc, art_id desc"
        end if
        set rs = conn.execute(sql)
        if not rs.eof then
        do while not rs.eof
        aa=cint(date()-rs("art_date"))
        if aa<10 then
        %>
            <li style="list-style-type:none;"><a style="float:left;" href="<%=nurl%>?id=<%=rs("art_id")%>" title="<%=rs("art_title")%>"><%=npic%><%newstitlelen rs("art_title"),nlen-3%></a><br>
        <%
        else
        %>
            <li style="list-style-type:none;"><a style="float:left;" href="<%=nurl%>?id=<%=rs("art_id")%>" title="<%=rs("art_title")%>"><%=npic%><%newstitlelen rs("art_title"),nlen%></a><br>
        <%
        end if
        rs.movenext
        loop
        else
            response.write("没有内容")
        end if
        rs.close
    end function"
#4
aspic2010-08-13 12:39
可以用分隔符 比如4$5
Split("$")
#5
lquvfhp2010-08-13 15:35
回复 4楼 aspic
分割副写在那呢?怎么写呀!谢谢
#6
lquvfhp2010-08-17 16:24
自己顶一下。希望有人帮我解答一下。
#7
lquvfhp2010-08-18 10:46
我亲爱的版主在那里?
#8
hams2010-08-19 08:36
看你的要求,我是越看越胡涂
1