```
$result123 = mysql_query("SELECT hours,date2, projekt FROM tidrapport_projekt_timmar WHERE username='$row1[0]' AND date2 BETWEEN '$begin' AND '$end' ORDER BY date2");
$i=1;
$n=0;
$p=0;
while ($row123=mysql_fetch_array($result123)) {
if(!empty($row123[hours])) {
if($row123[hours]!=null) {
${"datum".$i}=$row123[date2];
${"timmar".$i}=$row123[hours];
$pre = $i-1;
$count = ${"datum".$i}-${"datum".$pre};
if($row123[projekt]=="Sjuk") { $n++; } else { $n=0; }
if($n>$_POST[kday]) { $p++; }
$i++; } } }
```

What I want it to do is count days where “$row123[projekt]==“Sjuk”)”;

- If number of days “in a row” is above $_POST[kday] I want it to add +1 into variable “a”.

If not ^^ add +1 to variable “b”. - If number of days between “$row123[projekt]==“Sjuk”)” is under “$_POST[mday]” add +1 to variable “a”.

If not ^^ add +1 to variable “b”.

Any ideas? I know am on the vurge of solving it but I’m missing something…

Thnx