Bonjour à tous,

J'ai une requete qui m'affiche une liste de résulats dans un tableau :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$relance="SELECT MM_Entreprise.NumEntreprise, MM_Entreprise.NomEntreprise, MM_Entreprise.ContactEntreprise, MM_Entreprise.AdresseEntreprise, MM_Entreprise.VilleEntreprise, MM_Entreprise.Tel1Entreprise, MM_Relance.DateRelance
FROM MM_Entreprise, MM_Relance
WHERE MM_Relance.NumEntreprise = MM_Entreprise.NumEntreprise AND MM_Entreprise.loginName='{$_SESSION['logname']}' AND MM_Relance.loginName='{$_SESSION['logname']}'
GROUP BY MM_Entreprise.NumEntreprise
HAVING MAX( MM_Relance.DateRelance )  < DATE_SUB( CURDATE( ) , INTERVAL 30 DAY )
ORDER BY MM_Relance.DateRelance
";
 
$res_relance=mysql_query($relance)
     or die (mysql_error());
 
 
while($data2 = mysql_fetch_assoc($res_relance)) {
 
$datefr2=changedateusfr($data2['DateRelance']);
 
 
    echo "<tr></tr>";
    echo "<tr>";
	echo "<td bgcolor='#B1C0F5'><strong><a href='Consult_Entreprise.php?NumEntreprise=".$data2['NumEntreprise']."'>".$data2['NumEntreprise']."</a></strong></td>";
	echo "<td>".$data2['NomEntreprise']."</td>";
	echo "<td>".$data2['ContactEntreprise']."</td>";
	echo "<td>".$data2['AdresseEntreprise']."</td>";
	echo "<td>".$data2['VilleEntreprise']."</td>";
	echo "<td>".$data2['Tel1Entreprise']."</td>";
    echo "</tr>";
 
   }
Je souhaiterai que la requete ne m'affiche que 10 resultats, pour ça j'ai essayé LIMIT10 et c'est ok. Mais je voudrais que c'est 10 résultats changent à chaque fois que la page est chargée donc aléatoire.

Je ne sais pas si je peux me servir de rand()

Merci pour votre aide.