cs_axelred
Messages postés1Date d'inscriptionmardi 5 février 2002StatutMembreDernière intervention 5 février 2002 5 févr. 2002 à 00:25
salut,
essaye ce code, il marche très bien. bon program...
axel
<%
Dim edito__MMColParam
edito__MMColParam = "1"
if (Request.QueryString("origine") <> "") then edito__MMColParam = Request.QueryString("origine")
%>
<%
if refquestion=0 then
'---------------sélection des messages correspondant au thème---------
Set CONN = Server.CreateObject("ADODB.Connection")
CONN.Open "DSN"
Set rs = Server.CreateObject("ADODB.Recordset")%>
<%
rs.open "select* from nom_de_la_table", CONN
if rs.eof=true then
%>
pas de message(s) correspondant(s)
<%else%>
<%
rs.movefirst
compteur=0
'-------------------------cette boucle comptabilise le nombre de messages pour le thème choisi-------------------
do while not rs.eof
compteur=compteur+1
rs.movenext
loop
%>
<%n=compteur%>
<%'-----------------------génération d'un nombre aléatoire sur le nombre de messages correspondants--------------
Randomize Timer
aleatoire=Int(Rnd * n)+1
%>
<%rang=0%>
<%rs.movefirst
'-------------------------cette boucle cherche le message correspondant au nombre tiré au hasard-----------------
do while not rs.eof%>
<%rang=rang+1%>
<%if rang=aleatoire then%>
<table width="100%" border="0" cellspacing="0">
----,
<%=rs(\"champ1\")%>
</td>
<%end if%>
<%rs.movenext
loop%>
<%end if%>
<%
rs.close
Set rs=nothing
CONN.close
Set conn=nothing
%>
<%end if%>