webForumDet fria alternativet

Problem med paging

1 svar · 122 visningar · startad av saw

sawMedlem sedan mars 20011 880 inlägg
#1

Hej.
Jag har problem med paging. Jag får inga felmedelanden, men den vill inte skriva ut vilken sida man står på.
Jag har kollat och dubbelkollat, men nu ser jag ingenting. Vore tacksam för hjälp.

'Do While NOT RS2.EOF 'Tillhör orginal
'Här skall pagingen börja'********************************

Response.Write "<FONT SIZE=3>"
perpage = 10
For n = 1 to RS2.recordcount step perpage
If n <> 1 then response.write " &#0124; "
if n <> cint (request("start")) then
response.write "<a href=""" & request ("script_name") & "?start=" & n & """>"
else
response.write "<font color=""red"">"
end if
response.write n & " till "
if n + perpage <= RS2.recordcount then
response.write n + (perpage) - 1
else
response.write RS2.recordcount
end if
if n <> cint (request("start")) then
response.write "</a>"
else
response.write "</font>"
end if
next
if request("start") = "" then
start = 1
else
start = cint (request("start"))
end if
RS2.move start - 1
for row = start to start + (perpage - 1)
if RS2.eof then exit for
Response.Write "</FONT>"

'Här fortsätter orginal koden ******************************************
	SQL = "select * from inlagg where forum_id="&Request.Querystring("id")
	Set RS_inlagg = Databas.Execute(SQL)

	SQL = "select count(*) AS count_svar from inlagg where svar_id="&RS2("id")
	Set RS_count_svar = Databas.Execute(SQL)

	SQL = "select count(*) AS datum_check from inlagg where svar_id="&RS2("id")
	Set RS_datum_check = Databas.Execute(SQL)

    SQL = "select count(skribent) AS antalskribent from inlagg where svar_id="&RS2("id")
	Set RS_skribent = Databas.Execute(SQL)

	If RS_datum_check("datum_check") <> 0 then

		SQL = "select datum from inlagg where svar_id="&RS2("id")
		SQL = SQL & " order by datum desc"
		Set RS_datum = Databas.Execute(SQL)

	Else

		SQL = "select datum from inlagg where id="&RS2("id")
		SQL = SQL & " order by datum desc"
		Set RS_datum = Databas.Execute(SQL)

	End If
	color=color+1

	If color mod 2 = 0 then
			bgcolor="#C0C0C0"
		Else
			bgcolor="#FFFFFF"
	End If

'**********************************************
SQL = "select Datum from inlagg where id = " & RS2("id")
Set RSDatum = Databas.Execute(SQL)

Dim LatestThread,newPost
LatestThread = RSDatum("Datum")

If Cdate(LatestThread) < Cdate(Request.Coookies("latestVisit")) Then
newPost = "<img border=""0"" src=""bild/19.gif""> Japp"
Else
'newPost = "&nbsp;&nbsp;-"
newPost = "<img src=""bild/20.gif""> Nix"

End If
'************************************************

	If Cint(Request.Querystring("str_id")) = Cint(RS2("id")) then
		SQL = "select * from inlagg where svar_id="&RS2("id")
		Set RS_svar = Databas.Execute(SQL)

		%>
		  <tr bgcolor=<%=bgcolor%>>
		    <td width=1><a href=forum.asp?id=<%=Request.Querystring("id")%>&str_id=0>-</a></td>
		    <td><a href=inlagg.asp?forum_id=<%=Request.Querystring("id")%>&inlagg_id=<%=RS2("id")%>><%=RS2("amne")%></td>
   			 <td>
   			 <IMG Src="Bild/<%=RS2("Icon")%>.gif">&nbsp;
   			 <%=RS2("skribent")%>
   			 </td>
		    <td><%=RS_count_svar("count_svar")%></td>
		    <td>
		    <%
 Response.Write formatdatetime(RS2("datum"),2)
 response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp" & newPost

 %>

		    </td>
<td><%=RS2("hits")%></td>
		  </tr>
			<%
			Do Until RS_svar.EOF
			SQL = "select * from inlagg where id = " & RS_svar("id")
			Set RS_svar2 = Databas.Execute(SQL)

			SQL = "select Datum from inlagg where id = " & RS_svar("id")
			Set RSDatum = Databas.Execute(SQL)
'**********************************************

LatestThread = RSDatum("Datum")

If Cdate(LatestThread) < Cdate(Request.Coookies("latestVisit")) Then
newPost = "<img border=""0"" src=""bild/19.gif""> Japp"
Else
newPost = "<img src=""bild/20.gif""> Nix"

End If

			%>
		  <tr bgcolor=<%=bgcolor%>>
		  	 <td width=1></td>
		    <td>&nbsp;&nbsp;&nbsp;&nbsp;<a href=inlagg.asp?forum_id=<%=Request.Querystring("id")%>&inlagg_id=<%=RS2("id")%>#<%=RS_svar("id")%>><%=RS_svar("amne")%></td>
		    <td colspan=2>
		    <IMG Src="Bild/<%=RS_svar("Icon")%>.gif">&nbsp;
		    <%=RS_svar("skribent")%>
		    </td>
		    <td><%

 Response.Write formatdatetime(RS_svar2("datum"),2)
 response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp" & newPost
		    %>

		    </td>
<td><%'=RS_svar2("hits")%></td>

		  </tr>
			<%
			RS_svar.MoveNext
			Loop

	Else
		%>
		<tr bgcolor=<%=bgcolor%>>
		  	<td width=1>
  			<% If RS_count_svar("count_svar") <> 0 then %>
  				<a href=forum.asp?id=<%=Request.Querystring("id")%>&str_id=<%=RS2("id")%>>+</a>
  			<% End If %>
  			</td>
   			<td><a href=inlagg.asp?forum_id=<%=Request.Querystring("id")%>&inlagg_id=<%=RS2("id")%>><%=RS2("amne")%></td>
   			<td>
   			<IMG Src="Bild/<%=RS2("Icon")%>.gif">&nbsp;
   			<%=RS2("skribent")%></td>
    		<td><%=RS_count_svar("count_svar")%></td>
    		<td><%
 
 'Denna är den ihopfälda menyn
 Response.Write formatdatetime(RS_datum("datum"),2)
 response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp" & newPost
%>
    		</td>
 <td><%=RS2("hits")%></td>

  		</tr>
		<%
	End If
Set RS_count_svar = nothing
Set RS_datum_check = nothing
Set RS_datum = Nothing
Set RS_inlagg = Nothing
RS2.MoveNext
NEXT ' Tillhör paging
'Loop 'Tillhör orginal
Set RS2 = nothing

Jag insåg att jag var tvungen att lägga in ALL kod, annars så ser man nog inte riktigt.
------------------
saw
__
saw@songer.com www.mp3.com/saw_songer
_
_

[Redigerat av saw den 07 jan 2002]

[Redigerat av saw den 07 jan 2002]

PatrikBMedlem sedan mars 20002 836 inlägg
#2

en sub som jag har till paging för att kunna lista i detta format:

1 till 10 | 11 - 20 | ... osv

<%
Sub PageBar(ByVal iPage, ByVal iTotRecords, ByVal iPageSize)
	Dim N
	Dim strScriptName
	Dim intPageCount
	
	strScriptName = Request.ServerVariables("SCRIPT_NAME")
	Response.Write "<P>"
	
	For N = 1 TO iTotRecords Step iPageSize
		intPageCount = intPageCount + 1
		If N < iTotRecords Then
			If iPage <> N Then
				Response.Write "<A href=""" & strScriptName & "?page=" & intPageCount & """>" & _
					N & " till " & (N + iPageSize - 1) & "</A> &#0124; "
			Else
				Response.Write N & " till " & (N + iPageSize - 1) & " &#0124; "
			End If
		Else
			If iPage <> N Then
				Response.Write "<A href=""" & strScriptName & "?page=" & intPageCount & """>" & _
					N & " till " & (N + iPageSize - 1) & "</A>"
			Else
				Response.Write N & " till " & (N + iPageSize - 1)
			End If
		End If
	Next
	Response.Write "</P>"
End Sub
%>

cya,
PatrikB

------------------
-=* IF there is a wrong way to do something, then someone will do it *=-

136 ms totalt · 3 externa anrop · v20260731065814-full.2b84b982
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
133 ms — hämta tråd, inlägg och bilagor (db)