performance issue
Does the following code affect the performance?
This is a memberhsip script.
and for each member I check if he is online or offline?
since it has another recordset(rslog) that will be executed for each record inside the first recordset
if yes is there any other way?
rsFriend.Open "SELECT * friends"
If NOT (rsFriend.BOF AND rsFriend.EOF) Then
If CInt(intPage) > CInt(intPageCount) Then intPage = intPageCount
If CInt(intPage) <= 0 Then intPage = 1
If intRecordCount > 0 Then
rsFriend.AbsolutePage = intPage
intStart = rsFriend.AbsolutePosition
If CInt(intPage) = CInt(intPageCount) Then
intFinish = intRecordCount
Else
intFinish = intStart + (rsFriend.PageSize - 1)
End if
End If
numberOfColumns =5
columnsDone=0
Response.Write "<table><tr>"
If intRecordCount > 0 Then
For intRecord = 1 to rsFriend.PageSize
set rsLog=server.createobject("adodb.recordset")
strSql = "SELECT * FROM cmm_logTime WHERE offline=0 AND userid=" & rsFriend("userID")
rslog.Open strSQL, conn,3, 3
if not rsLog.eof then
strOnline="y"
else
strOnline="n"
end if
%>
<TD class=picFrame style="MARGIN: 0px" vAlign=top align=middle><SPAN >
<DIV class=head> <A href="profile.asp?uid=<%=rsFriend("userID")%>" >
<%if rsFriend("userPic") <> "" Then%><IMG alt=<%=rsFriend("firstname")%> src="user_images/<%=rsFriend("UserPic")%>" width=<%=intWidth%> height=<%=intHeight%> border=0>
<%else%>
<%if rsFriend("gender")="male" then%>
<IMG alt=<%=rsFriend("firstname")%> src="user_images/noimage_male.jpg" width=<%=intWidth%> height=<%=intHeight%> border=0>
<%else%>
<IMG alt=<%=rsFriend("firstname")%> src="user_images/noimage_female.jpg" width=<%=intWidth%> height=<%=intHeight%> border=0>
<%end if%>
<%end if%>
<%=left(rsFriend("firstname"),12)%></SPAN>(<%=rsFriend("Friend_COUNT")%>)</A>
<br><%if strOnline="y" then response.write "Online" else response.write "Offline"%>
</div>
</TD>
<%
columnsDone = columnsDone + 1
rsFriend.MoveNext
If columnsDone Mod numberOfColumns = 0 Then
Response.Write "</tr><tr>"
End If
If rsFriend.EOF Then Exit for
Next
'Response.Write "</tr></table>"
end if
end if
%>
|