title: count where different is more than 2 days
body: <p>Hi i have this code that I would like to get the total of log that is closed.</p>
  
  <blockquote>
    <p><strong>(A)</strong> More than 2 days.
    <strong>(B)</strong> Less than 2 days.</p>
  </blockquote>
  
  <pre><code>for($m=1; $m&lt;=12; ++$m) {
  
     $next_year = $cur_year + 1;
     $monthName=date('M', mktime(0, 0, 0, $m, 1)).'';
     $monthNumber  = date('m', mktime(0, 0, 0, $m, 1));
     $monthName  = date('F', mktime(0, 0, 0, $m, 1));
     $currentMonthText = date('Y-m-d', mktime(0, 0, 0, $m, 1));
     $nextMonthText    = date('Y-m-d', mktime(0, 0, 0, $m + 1, 1));
  
     $result= $DB-&gt;query("SELECT * FROM ".$DB-&gt;prefix("calldesk_log")." 
     WHERE MONTH(date_open)='$monthNumber' AND date_open &gt;=  '$currentMonthText'
     AND date_open &lt;  '$nextMonthText' AND status='Closed'") or die(mysql_error()); 
  
  
      while($row = $DB-&gt;fetchArray($result))
      {
         $id_report=$row['id_report)'];
         $date_open=$row['date_open'];
         $date_close=$row['date_close'];
         $diff = abs(strtotime($date_open) - strtotime($date_close));
         $min = floor($diff / (60*60*24)); 
      }
  }
  </code></pre>
  
  <p>Any help will be appreciated.  </p>