webForumDet fria alternativet

emissions dela upp <td&lg;

ASP

5 svar · 155 visningar · startad av Jörgen HP

Medlem sedan feb. 20012 412 inlägg
Frågan#1

Hej!

Nu har det blivit för mycket för min lilla hönshjärna :e

varför blir det dubbelt av alla?

mvh Jörgen :(

numcols=3
intCount = ubound(arrRecords,2)+1
numrows = ceil(intCount/numcols)

response.write "<TABLE>"
for j=1 to numrows
response.write "<TR>"
for z=1 to numcols
intCurPos=numrows*(z-1)+j
response.write "<TD width=""200"">"
				
if  intCurPos>intCount then
response.write " "
					else

For I = intStartID To ((intStartID + intPageSize) -1)

intId = arrRecords(0,I)
strHemsida = arrRecords(1,I)
strUrl = arrRecords(2,I)
strDescription = arrRecords(3,I)
dtePostDate = arrRecords(4,I)
intHit = arrRecords(5,I)
strCat = arrRecords(7,I)

Response.Write "<p> <a href="""&strUrl&""" target=""_blank""> " & strHemsida & "</a> ("& intHit &")<BR>"& strDescription &"</p>"

If I = UBound(arrRecords,2) Then Exit For
Next

end if
response.write "</TD>"
next
response.write "</TR>"
next
response.write "</TABLE>"

function ceil(dblValue)
intTest=int(dblValue)
if intTest<dblValue then
ceil=intTest+1
else
ceil=intTest
end if
end function

------------------
Varför bråka när man kan kramas?

[Redigerat av jorgen den 23 dec 2001]

Medlem sedan feb. 20012 412 inlägg
#2

Hej, har kommit på beskymmret, lite klantigt.

Både pagingen och uppdelningsscriptet loopar till sista posten i arryen.

jag har provat att ändra lite, men får inte den till att räkna rätt:

mvh Jörgen :)

numcols=3
intCount = ((intStartID + intPageSize) -1)
numrows = ceil(intCount/numcols)
response.write "<TABLE>"
for j=1 to numrows
response.write "<TR>"
for z=1 to numcols
intCurPos=numrows*(z-1)+j
response.write "<TD width=""200"">"
if  intCurPos>intCount then
response.write " "
else

intId = arrRecords(0,z)
strHemsida = arrRecords(1,z)
strUrl = arrRecords(2,z)
strDescription = arrRecords(3,z)
dtePostDate = arrRecords(4,z)
intHit = arrRecords(5,z)
strCat = arrRecords(7,z)

Response.Write "<p> <a href="""&strUrl&""" target=""_blank""> " & strHemsida & "</a> ("& intHit &")<BR>"& strDescription &"</p>"
				
end if
response.write "</TD>"
next
response.write "</TR>"
next
response.write "</TABLE>"

function ceil(dblValue)
intTest=int(dblValue)
if intTest<dblValue then
ceil=intTest+1
else
ceil=intTest
end if
end function

------------------
Varför bråka när man kan kramas?

Medlem sedan feb. 20012 412 inlägg
#3

Jag har kommit en bit på väg, nu ser koden ut enligt nedan. Det fungerar bra förutom att den börjar på fel post.

Från början såg for-slingan ut så här:

For I = intStartID To ((intStartID + intPageSize) -1)

Alltså vill jag ha in intStartId som startvärde i loopen, men lyckas inget vidare. Någon som har någon ide?

numcols=3
intCount= ((intStartID + intPageSize) -1) 'ubound(arrRecords,2)+1
numrows=ceil(intCount/numcols)

response.write "<TABLE>"
for j=1 to numrows
response.write "<TR>"
for i=1 to numcols
intCurPos=numrows*(i-1)+j
response.write "<TD>"
if  intCurPos>intCount then
response.write " "
else
response.write "<p>"& arrRecords(0,intCurPos-1) &"<br>"& arrRecords(1,intCurPos-1) &"<br>"& arrRecords(2,intCurPos-1) &"<br>"
			
end if
response.write "</TD>"
next
response.write "</TR>"
next
response.write "</TABLE>"

function ceil(dblValue)
	intTest=int(dblValue)
	if intTest<dblValue then
		ceil=intTest+1
	else
		ceil=intTest
	end if
end function

------------------
Varför bråka när man kan kramas?

Medlem sedan mars 20007 896 inlägg
#4

Något sånt här tycker jag borde funka, enkelt o bra. :)

Response.Write "<table>"

iController = 1

For i = lBound ( arrRecords, 2 ) To uBound ( arrRecords, 2 )
    If iController = 1 Then
      Response.Write "<tr>"
    End If

    Response.Write "<td><p>"
    Response.Write arrRecords ( 0, i ) & "<br>"
    Response.Write arrRecords ( 1, i ) & "<br>"
    Response.Write arrRecords ( 2, i ) & "<br>"
    Response.Write "</p></td>"

    If iController = 3 Then
      Response.Write "</tr>"
		
      iController = 0
    End If

    iController = iController + 1
Next

Response.Write "</table>"

Red.} Hade snubblat på tangenterna. :l

------------------
SPiN, bjorne.w@telia.com

-- En ask vet jag stånda - den Yggdrasil heter, ett väldigt träd överöst av vita sanden. --

[Redigerat av SPiN den 24 dec 2001]

Medlem sedan mars 20007 896 inlägg
#5

Ok, back again.

<%
set objC = Server.CreateObject ( "ADODB.Connection" )
objC.Open "driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\Databas.mdb"

sSQL = "SELECT hits, namn, url FROM Tabell"
set objRS = objC.Execute ( sSQL )

If objRS.EOF Then
    objRS.Close
    objC.Close
    set objRS = Nothing
    set objC = Nothing

    Response.Write "Tomt!"
    Response.End
End If

arrRecords = objRS.GetRows ()
objRS.Close
objC.Close
set objRS = Nothing
set objC = Nothing

If Request.QueryString ( "nextPost" ) <> "" Then
    iNext = cInt ( Request.QueryString ( "nextPost" ) )
Else
    iNext = lBound ( arrRecords, 2 )
End If

If Request.QueryString ( "numPosts" ) <> "" Then
    iPosts = cInt ( Request.QueryString ( "numPosts" ) )
Else
    iPosts = 3
End If

If ( iNext + iPosts ) < uBound ( arrRecords, 2 ) Then
    iPosts = uBound ( arrRecords, 2 ) - iNext
End If

Response.Write "<table>"

iController = 1

For i = iNext To ( iPosts - 1 )
    If iController = 1 Then
      Response.Write "<tr>"
    End If

    Response.Write "<td><p>"
    Response.Write arrRecords ( 0, i ) & "<br>"
    Response.Write arrRecords ( 1, i ) & "<br>"
    Response.Write arrRecords ( 2, i ) & "<br>"
    Response.Write "</p></td>"

    If iController = 3 Then
      Response.Write "</tr>"
		
      iController = 0
    End If

    iController = iController + 1
Next

Response.Write "</table>"

If iNext < uBound ( arrRecords, 2 ) Then
    Response.Write "<a href=""" & Request.ServerVariables ( "SCRIPT_NAME" ) & "?nextPost=" & ( iNext + iPosts ) & "&sumPosts=" & iPosts & """>Nästa</a> - "
End If

If iNext > lBound ( arrRecords, 2 ) Then
    Response.Write "<a href=""" & Request.ServerVariables ( "SCRIPT_NAME" ) & "?nextPost=" & ( iNext - iPosts ) & "&sumPosts=" & iPosts & """>Föregående</a>"
End If
%>

------------------
SPiN, bjorne.w@telia.com

-- En ask vet jag stånda - den Yggdrasil heter, ett väldigt träd överöst av vita sanden. --

[Redigerat av SPiN den 24 dec 2001]

Medlem sedan feb. 20012 412 inlägg
#6

Du är en klippa SPIN :D

Tusen tack, fungerar utmärkt!

------------------
Varför bråka när man kan kramas?

267 ms totalt · 4 externa anrop · v20260731065814-full.86ec41c2
125 ms — deklarationer (db)
0 ms — hämta statistik (cache)
136 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)