qui sotto ce il codice in poche parole se l'id esiste mi scrive il sito e se non esiste mi scrive l'id... il problema è che al posto di far scrivere l'id vorrei far ricercare nuovamente con la funzione random nel database... che devo fare un ciclo? se si come si fa... se no cosa devo fare? grazie
<%
SQL = "select Max(id) as maxid from tabella where cal >= 2"
rs.open SQL, cn, 3,3
If Not rs.Eof Then
dim maxID, valorernd
maxID = rs("maxid")
else
maxid = 0
end if
rs.close
randomize timer
valorernd = cint(rnd * (maxid-1))+1
sql = "select id from tabella where id = " & valorernd
rs.open SQL, cn, 3,3
if rs.eof then
response.write valorernd
else
rs.close
sql = "select top 1 url from tabella where id = " & valorernd
rs.open SQL, cn, 3,3
valore = rs("url")
response.write valore
end if
rs.close
cn.close
set rs = nothing
set cn = nothing
%>

Rispondi quotando