Jump to content

Another counting-problem


electrix

Recommended Posts


$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")";

1. 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".

2. 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

Link to comment
https://forums.phpfreaks.com/topic/43942-another-counting-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.