strSQL = "SELECT MAX(TRIN) AS MAX_TRIN FROM PLUSPROFIL_ANNONCE" set rs = dataConn.execute(strSQL) strMaxTrin = RS("MAX_TRIN")
strAnnonceIDs = ""
'skal optimeres senere dim arrPlusprofier(99) dim arrPlusprofierValgte(99)
i = 0
strQuery = "SELECT ANNONCE_ID, TRIN FROM PLUSPROFIL_ANNONCE WHERE POINTS < MAXPOINTS AND TRIN <> 0" set rs = dataConn.execute(strQuery) while not (rs.eof or rs.bof) arrPlusprofier(i)(0) = rs("Annonce_id") arrPlusprofier(i)(1) = rs("Trin") i = i + 1 wend
y = 0 u = 0 For y = LBound(arrPlusprofier) To UBound(arrPlusprofier) and u < 10 randomize ranValue = int(i * rnd) randomize ranValue2 = int(strMaxTrin * rnd)
if (arrPlusprofier(ranValue)(1)) > ranValue2 then arrPlusprofierValgte(u)(0) = arrPlusprofier(ranValue)(0) arrPlusprofierValgte(u)(1) = arrPlusprofier(ranValue)(1) u = u + 1 end if
next
if u > 1 then WriteTableStart "Plusprofiler", strHeadCellColor, "100%", "/grafik/layout/wavyb.gif" strSQL="SELECT * from PLUSPROFIL_ANNONCE WHERE " & right(strAnnonceIDs, len(strAnnonceIDs) - 4) & " ORDER BY TRIN DESC LIMIT 0,3" makePlusProfil strSQL, "true", "4", "true" WriteTableEnd makeSpace(5) end if
strQuery = "SELECT COUNT(*) AS COUNT_RECORDS FROM PLUSPROFIL_ANNONCE WHERE POINTS < MAXPOINTS AND TRIN <> 0" set rs = dataConn.execute(strQuery) if not (rs.eof or rs.bof) then strCountRecords = round(rs("COUNT_RECORDS"))
'skal optimeres senere redim arrPlusprofil(strCountRecords, 2)
i = 0
strQuery = "SELECT ANNONCE_ID, TRIN FROM PLUSPROFIL_ANNONCE WHERE POINTS < MAXPOINTS AND TRIN <> 0 ORDER BY TRIN DESC" set rs = dataConn.execute(strQuery) while not (rs.eof or rs.bof) arrPlusprofil(i,0) = rs("Annonce_id") arrPlusprofil(i,1) = rs("Trin") strTrinAll = int(strTrinAll) + int(rs("Trin")) rs.movenext i = i + 1 wend
strTrinMiddel = int(strTrinAll / strCountRecords)
strAnnonceIDs = ""
u = 0 p = 0
For i = LBound(arrPlusprofil) To UBound(arrPlusprofil)
'find tilfældig record randomize ranValue = int(strCountRecords * rnd)
'find tilfældig værdi som dens trin skal overstige randomize ranValue2 = int(strTrinMiddel * rnd)
if int(arrPlusprofil(ranValue, 1)) > int(ranValue2) then if inStr(strAnnonceIDs, arrPlusprofil(ranValue, 0)) = 0 then strAnnonceIDs = strAnnonceIDs & " OR ANNONCE_ID = " & arrPlusprofil(ranValue, 0) u = u + 1 end if end if p = p + 1
if u > 6 or p > (strCountRecords / 2) then exit for end if next
if u > 3 then WriteTableStart "Plusprofiler", strHeadCellColor, "100%", "/grafik/layout/wavyb.gif" strSQL="SELECT * from PLUSPROFIL_ANNONCE WHERE " & right(strAnnonceIDs, len(strAnnonceIDs) - 4) & " ORDER BY TRIN DESC LIMIT 0,3" makePlusProfil strSQL, "true", "4", "true" WriteTableEnd makeSpace(5) end if end if
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.