Med denna kod visas bara två bilder trots att fler än så har bilder uppladdade, det ska visas 7 stVarför visas bara två bilder
Kod:
<%Dim oConn ,strSQL ,bilder ,i, j ,Count ,post ,antalBilder ,Found
Set oConn = server.CreateObject("ADODB.Connection")
oConn.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=193.13.74.203;PORT=3306;DATABASE=xxxxxx; USER=xxxxxx;PASSWORD=xxxxxx;OPTION=3;"
strSQL = "SELECT userID, username, picture, fotovalidering FROM tblUsers WHERE not picture=""nopic.jpg"" and not fotovalidering=1"
Set rs = oConn.Execute(strSQL)
If rs.EOF Then
Response.Write "Det finns inga bilder..."
Else
Response.Write "<table cellspacing=""3""><tr><td align=""left"">"
bilder = rs.GetRows()
antalBilder = UBound(bilder, 2)
Count = 7
If Count > antalBilder Then
Count = antalBilder
End If
ReDim Shown(Count)
Randomize
For i = 1 To Count
Do
Found = False
post = Int(Rnd * antalBilder) +1
For j = 1 To i - 1
If Shown(j) = post Then
Found = True
Exit For
End If
Next
Loop While Found
Shown(i) = post
'Response.Write " "
Response.Write "<img style=""border-style:none;"" height=""60"" width=""50"" src=""/images/users/" & bilder(2, post) & """ alt=""" & bilder(1, post) & """ /> "
Next
Response.Write "</td></tr></table>"
End If
rs.Close
Set rs = Nothing
%>