ASP循环读取数据库内容,只读取判断了一次,后面读取出来有内容,但是用户名不对,取的样式不对,求解
<%Fori=0ToUBound(sconary)leftsconary=Split(sconary(i),"回复(")ifisnull(Curtime)thencurt...
<%
For i=0 To UBound(sconary)
leftsconary=Split(sconary(i)," 回复(")
if isnull(Curtime) then curtime="首次提问"
If UBound(leftsconary)>0 Then
curtime=Replace(Replace(Replace(Left(leftsconary(1),20),")--",""),")-",""),")","")
End if
leftsconary1=Split(leftsconary(0),"-------")
curusername1="管理员"
If leftsconary1(UBound(leftsconary1))=sconary(i) Then curusername1="用户"
Rsconary=Split(sconary(i),")-------")
leftsconary2=Split(leftsconary(0),"-------")
curusername2="official"
If leftsconary2(UBound(leftsconary2))=sconary(i) Then curusername2="user-record"
Rsconary=Split(sconary(i),")-------")
leftsconary3=Split(leftsconary(0),"-------")
curusername3="official"
If leftsconary3(UBound(leftsconary2))=sconary(i) Then curusername3="user"
Rsconary=Split(sconary(i),")-------")
leftsconary4=Split(leftsconary(0),"-------")
curusername4=""
If leftsconary4(UBound(leftsconary2))=sconary(i) Then curusername4="clearfix pull-right"
Rsconary=Split(sconary(i),")-------")
leftsconary5=Split(leftsconary(0),"-------")
curusername5=""
If leftsconary5(UBound(leftsconary2))=sconary(i) Then curusername5="text-right"
Rsconary=Split(sconary(i),")-------")
If UBound(Rsconary)>0 Then
endscon=Rsconary(1)
Else
endscon=Rsconary(0)
End if
%>
<div class="talk-deck clearfix">
<div class="talk-record <%=curusername3%>-record" data-record_id="">
<div class="talk-person <%=curusername5%>">
<span class="text-muted"><%=curtime%></span>
<span class="<%=curusername3%>">
<%=curusername1%>
</span>
</div>
<div class="talk-content <%=curusername4%>">
<div class="talk-content-row">
<%=Replace(endscon,vbcrlf,"")%><br>
</div>
</div>
</div>
</div>
<%next%>
<%end if%>
输出结果
2017-11-18 3:01:57 用户
我内容
2017-11-18 3:05:09 管理员
admin内容
2017-11-18 3:27:00 管理员(此处本应是用户回复的,取的样式curusername2/3/4/5也没有取到,用的还是管理员的样式)
看
2017-11-18 3:27:26 管理员(此处本应是用户回复的,取的样式curusername2/3/4/5也没有取到,用的还是管理员的样式)
测试
输出结果end
上面两处本应是用户回复的,取的样式curusername2/3/4/5也没有取到,用的还是管理员的样式,用户名也没读出来,恳请大神解答 展开
For i=0 To UBound(sconary)
leftsconary=Split(sconary(i)," 回复(")
if isnull(Curtime) then curtime="首次提问"
If UBound(leftsconary)>0 Then
curtime=Replace(Replace(Replace(Left(leftsconary(1),20),")--",""),")-",""),")","")
End if
leftsconary1=Split(leftsconary(0),"-------")
curusername1="管理员"
If leftsconary1(UBound(leftsconary1))=sconary(i) Then curusername1="用户"
Rsconary=Split(sconary(i),")-------")
leftsconary2=Split(leftsconary(0),"-------")
curusername2="official"
If leftsconary2(UBound(leftsconary2))=sconary(i) Then curusername2="user-record"
Rsconary=Split(sconary(i),")-------")
leftsconary3=Split(leftsconary(0),"-------")
curusername3="official"
If leftsconary3(UBound(leftsconary2))=sconary(i) Then curusername3="user"
Rsconary=Split(sconary(i),")-------")
leftsconary4=Split(leftsconary(0),"-------")
curusername4=""
If leftsconary4(UBound(leftsconary2))=sconary(i) Then curusername4="clearfix pull-right"
Rsconary=Split(sconary(i),")-------")
leftsconary5=Split(leftsconary(0),"-------")
curusername5=""
If leftsconary5(UBound(leftsconary2))=sconary(i) Then curusername5="text-right"
Rsconary=Split(sconary(i),")-------")
If UBound(Rsconary)>0 Then
endscon=Rsconary(1)
Else
endscon=Rsconary(0)
End if
%>
<div class="talk-deck clearfix">
<div class="talk-record <%=curusername3%>-record" data-record_id="">
<div class="talk-person <%=curusername5%>">
<span class="text-muted"><%=curtime%></span>
<span class="<%=curusername3%>">
<%=curusername1%>
</span>
</div>
<div class="talk-content <%=curusername4%>">
<div class="talk-content-row">
<%=Replace(endscon,vbcrlf,"")%><br>
</div>
</div>
</div>
</div>
<%next%>
<%end if%>
输出结果
2017-11-18 3:01:57 用户
我内容
2017-11-18 3:05:09 管理员
admin内容
2017-11-18 3:27:00 管理员(此处本应是用户回复的,取的样式curusername2/3/4/5也没有取到,用的还是管理员的样式)
看
2017-11-18 3:27:26 管理员(此处本应是用户回复的,取的样式curusername2/3/4/5也没有取到,用的还是管理员的样式)
测试
输出结果end
上面两处本应是用户回复的,取的样式curusername2/3/4/5也没有取到,用的还是管理员的样式,用户名也没读出来,恳请大神解答 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询