Strula me val av utskrift

ASP

1 svar · 175 visningar · startad av Asa

Medlem sedan dec. 20011 860 inlägg
Trådstart#1

Har en kod som ska känna av om man valt att vara anonym men den visar användarnamnet iallafall. Nån som ser vad jag gjort fel? Den hämtar rätt inlägg fast den i startad.Första If satsen där man hämtar där userId=" & RS("user") men den visar samma namn på senaste.

http://www.gruvsjo.com/fm

<%Do While Not RS.EOF%>

   <tr bgcolor="<%=farg%>">
      <td>&nbsp;</td>
      <td><b><a href="forum.asp?id=<%=RS("id")%>"><%=RS("subject")%></b></td>
<%Set User=Conn.Execute("Select * From users Where userId=" & RS("user"))
If RS("statustyp") <> True Then%>
      <td><a href="mem.asp?userid=<%=User("userid")%>"><%=User("username")%></a><br><%If FormatDateTime(RS("date"),2) = FormatDateTime(Now(),2) Then%>Idag (<%=FormatDateTime(RS("date"),4)%>)<%Else%><%=FormatDateTime(RS("date"),2)%> (<%=FormatDateTime(RS("date"),4)%>)<%End If%></td>
<%Else%>
      <td>Anonym<br><%If FormatDateTime(RS("date"),2) = FormatDateTime(Now(),2) Then%>Idag (<%=FormatDateTime(RS("date"),4)%>)<%Else%><%=FormatDateTime(RS("date"),2)%> (<%=FormatDateTime(RS("date"),4)%>)<%End If%></td>
<%End If
User.Close%>
      <td align="center"><%=RS("answers")%></td>
      <td align="center"><%=RS("read")%></td>
<%Set User=Conn.Execute("Select * From users Where userId=" & RS("latestuser"))
If RS("statustyp") <> True Then%>
      <td><a href="mem.asp?userid=<%=User("userid")%>"><%=User("username")%></a><br><%If FormatDateTime(RS("latest"),2) = FormatDateTime(Now(),2) Then%>Idag (<%=FormatDateTime(RS("latest"),4)%>)<%Else%><%=FormatDateTime(RS("latest"),2)%> (<%=FormatDateTime(RS("latest"),4)%>)<%End If%></td>
<%Else%>
      <td>Anonym<br><%If FormatDateTime(RS("latest"),2) = FormatDateTime(Now(),2) Then%>Idag (<%=FormatDateTime(RS("latest"),4)%>)<%Else%><%=FormatDateTime(RS("latest"),2)%> (<%=FormatDateTime(RS("latest"),4)%>)<%End If%></td>
<%End If
User.Close%>
   </tr>

<%x=x+1
RS.MoveNext
Loop%>
Medlem sedan dec. 20011 860 inlägg
#2

Löste det med detta:

<%Set User=Conn.Execute("Select * From users Where userId=" & RS("user"))%>
      <td><%If RS("statustyp") <> True Then%><a href="mem.asp?userid=<%=User("userid")%>"><%=User("username")%></a><%Else%>Anonym<%End If%><br><%If FormatDateTime(RS("date"),2) = FormatDateTime(Now(),2) Then%>Idag (<%=FormatDateTime(RS("date"),4)%>)<%Else%><%=FormatDateTime(RS("date"),2)%> (<%=FormatDateTime(RS("date"),4)%>)<%End If%></td>
<%User.Close%>
      <td align="center"><%=RS("answers")%></td>
      <td align="center"><%=RS("read")%></td>
<%Set ReS=Conn.Execute("Select * From forum Where uid='" & RS("id") & "' Order By date desc")
Set User=Conn.Execute("Select * From users Where userId=" & ReS("latestuser"))%>
      <td><%If ReS("statustyp") <> True Then%><a href="mem.asp?userid=<%=User("userid")%>"><%=User("username")%></a><%Else%>Anonym<%End If%><br><%If FormatDateTime(RS("latest"),2) = FormatDateTime(Now(),2) Then%>Idag (<%=FormatDateTime(RS("latest"),4)%>)<%Else%><%=FormatDateTime(RS("latest"),2)%> (<%=FormatDateTime(RS("latest"),4)%>)<%End If%></td>
<%User.Close
Res.Close%>
246 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
118 ms — deklarationer (db)
0 ms — hämta statistik (cache)
122 ms — hämta tråd, inlägg och bilagor (db)
114 ms — ändringar (db)