|
@@ -45,8 +45,13 @@ class Categorie {
|
45
|
45
|
$bdd = new Connector();
|
46
|
46
|
$arrayCat = $bdd->Select("*", "categorie");
|
47
|
47
|
$return = array();
|
|
48
|
+ $catIndex = -1;
|
|
49
|
+ $previousIndex = -1;
|
48
|
50
|
for($i = 0; $i < 2; $i++) {
|
49
|
|
- $catIndex = rand(0, sizeof($arrayCat)-1);
|
|
51
|
+ do {
|
|
52
|
+ $previousIndex = $catIndex;
|
|
53
|
+ $catIndex = rand(0, sizeof($arrayCat)-1);
|
|
54
|
+ } while($catIndex == $previousIndex);
|
50
|
55
|
array_push($return, new Categorie($arrayCat[$catIndex]['nom_cat']));
|
51
|
56
|
}
|
52
|
57
|
return $return;
|