Bonjour à tous
J'ai un souci d'affichage de résultat issu d'une boucle sur un switch...

ma table1 est composée comme suit:

id_table day h1 h2

1 Mon 0 5
2 Mon 0 0

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 
$date1 = Mon;
$hms=1;
$i =1;
$r = 3;
$array=array();
 
while ( $i < $r) {
$resultatfiche=mysql_query("select * from table1 where id_table like '".$i."' and day like '".$date1."'",$connexion_sql);
 
if (mysql_num_rows($resultatfiche) != 0){
$day=mysql_result($resultatfiche,0,"day");
$h1=mysql_result($resultatfiche,0,"h1");
$h2=mysql_result($resultatfiche,0,"h2");
 
switch ($date1) 
  { 
   case 'Mon': 
       if (($h1<$hms) and ($hms<($h2))
	{
	   $var='2';}
	   else {
	   $var='1';}
        break; 
 
   case 'Tue': 
        if (($h1<$hms) and ($hms<($h2))
	{
	   $var='2';}
	   else {
	   $var='1';}
        break; 
 
etc...
 
   case 'Sun': 
          if (($h1<$hms) and ($hms<($h2))
	{
	   $var='2';}
	   else {
	   $var='1';}
        break; 
 
else {
$var='3';
}
$array[$i]="$var";
 
$i++;
}
$array=array_count_values($array);
print_r($tableau);
Résultat...

Array ( [3] => 1 [2] => 1 [] => 1 )

alors que je cherche à avoir:

Array ( [3] => 1 [2] => 1 [1] => 1 )

Quelqu'un peut il m'aider?