Update of /home/spip-cvs/spip
In directory alan:/tmp/cvs-serv10188
Modified Files:
inc-criteres.php3
Log Message:
utiliser RAND() sy MySQL connait
Index: inc-criteres.php3
RCS file: /home/spip-cvs/spip/inc-criteres.php3,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- inc-criteres.php3 21 Sep 2004 19:40:08 -0000 1.16
+++ inc-criteres.php3 22 Sep 2004 21:03:38 -0000 1.17
@@ -214,9 +214,14 @@
// par hasard
if ($tri == 'hasard') {
- // on pourrait peut-etre passer a "RAND() AS alea" ?
- $boucle->select[] = "MOD(".$boucle->id_table . '.' . $boucle->primary." * UNIX_TIMESTAMP(),
- 32767) & UNIX_TIMESTAMP() AS alea";
+ // tester si cette version de MySQL accepte la commande RAND()
+ // sinon faire un gloubi-boulga maison avec de la mayonnaise.
+ if (spip_query("SELECT RAND()"))
+ $boucle->select[] = "RAND() AS alea";
+ else
+ $boucle->select[] = "MOD(".$boucle->id_table.'.'.$boucle->primary
+ ." * UNIX_TIMESTAMP(),32767) & UNIX_TIMESTAMP() AS alea";
+
$boucle->order = "'alea'";
}