webForumDet fria alternativet
Logga in / Bli medlem

Forum Problem

ASP

1 svar · 153 visningar · startad av voigtann1

Medlem sedan juni 20019 519 inlägg
Trådstart#1

Kan någon förklara detta?:
Jag kör när man läser inlägget i en topic så ska den visa 15 inlägg sen en ny sida...
Problemet är när jag byter sida.. så tycks första inlägget dvs den person som startade topicen försvinna och jag får ett error.
Det konstiga är att jag inte kör pageingen ens med den delen av sidan...

<%
	Session.LCID = 1053
	Set Databas = Server.CreateObject("ADODB.Connection")
	MdbFilePath = Server.MapPath("db/db.mdb")
	Session("dbasepath") = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
	Databas.Open Session("dbasepath")

	'on error resume next

		SQL = "select * from forums where ID = "&Request.Querystring("forum_id")
		Set forum = Databas.Execute(SQL)

		SQL = "select * from topics where ID = "&Request.Querystring("inlagg_id")
		Set topics = Databas.Execute(SQL)

		strSQL = "select * from answers where svar_id = "&Request.Querystring("inlagg_id")
		set RS3 = Server.CreateObject("ADODB.RecordSet")
		RS3.Open strSQL, Databas, 3, 3

[b]		SQL = "SELECT * from members WHERE username = '"& topics("skribent") &"'" [/b]
		Set avtarinfo = Databas.Execute(SQL)

		SQL = "select count(*) AS Antal from (select 1 from topics where skribent = '"& topics("skribent") &"'" &_
	   	"union all" &_
	   	" select 1 from answers where skribent = '"& topics("skribent") &"')"
		Set RS4 = Databas.Execute(SQL)

%>
FÖRSTA LÄGGET HÄR
<% 
	if rs3.EOF then
	else
	'PAGEING
		intPageId = request.querystring("pageid")
			if intPageId = "" then intPageId = 1
		with rs3
		  .pagesize = 1
		  .absolutepage = intPageId
		end with

		intPages = cint(rs3.pagecount)
		intCurrentPost = 0

	'END PAGEING

'Pageing style
function getPreviousLink( intPageId )
  if intPageId > 1 then
    getPreviousLink = " <a href=""?ID="&request.querystring("ID")&"&pageid=" & intPageId - 1 & """><</a> "
  else
    getPreviousLink = ""
  end if
end function

function getNextLink( intPageId, intPages )
  if cint( intPageId ) < cint( intPages ) then
    getNextLink = " <a href=""?forum_id="&request.querystring("forum_id")&"&inlagg_id="&request.querystring("forum_id")&"&pageid=" & intPageId + 1 & """>></a> "
  else
    getNextLink = ""
  end if
end function

function getLastLink( intPageCount )
  if intPages >= 10 then
    getLastLink = " <a href='?forum_id="&request.querystring("forum_id")&"&inlagg_id="&request.querystring("forum_id")&"&pageid=" & intPages & "'>>></a> "
  end if
end function

function getFirstLink()
  if intPages >= 10 then
    getFirstLink = " <a href='?forum_id="&request.querystring("forum_id")&"&inlagg_id="&request.querystring("forum_id")&"&pageid=1'><<</a> "
  end if
end function

	Do While NOT RS3.EOF and intCurrentPost < rs3.pagesize

	SQL = "SELECT COUNT(*) AS Antal FROM topics WHERE skribent = '"& RS3("skribent") &"'" 
	Set RS5 = Databas.Execute(SQL)

	SQL = "SELECT * from members WHERE username = '"& RS3("skribent") &"'" 
	Set avtarinfo2 = Databas.Execute(SQL)

		SQL = "select count(*) AS Antal from (select 1 from topics where skribent = '"& RS3("skribent") &"'" &_
	   	"union all" &_
	   	" select 1 from answers where skribent = '"& RS3("skribent") &"')"
		Set RS6 = Databas.Execute(SQL)
%>
ALLA SVAR!
<%
for i = 1 to rs3.pagecount
  If i = CInt(intPageId) Then
    strNavigation = strNavigation & " |" & i & "|"
  Else
    strNavigation = strNavigation & " <a href=""?forum_id="&request.querystring("forum_id")&"&inlagg_id="&request.querystring("forum_id")&"&pageid=" & i & """>" & i & "</a>"
  End If
next
	response.write ""& getFirstLink() & getPreviousLink( intPageId ) &" "& strNavigation & " " & getNextLink( intPageId, intPages ) & getLastLink( intPageCount )&"" 
%>

P.S Första sidan fungera... det är när jag byter sida...

Medlem sedan juni 20019 519 inlägg
#2

Fixat!

387 ms totalt · 4 externa anrop · v20260731065814-full.51f67c91
124 ms — deklarationer (db)
128 ms — hämta statistik (db)
129 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)