query($sql); if ($resultA->num_rows > 0) { while($row = $resultA->fetch_assoc()){ $count = $count + 1; $date1 = new DateTime($row['cl_sla_start']); $date2 = new DateTime($curDate); $interval = $date1->diff($date2); if($interval->days > 1){ $withS = 's'; }else{ $withS = ''; } $intervalDates = $interval->days; $rows[] = [$row,"days"=>"$intervalDates", "Count" =>"$count"]; } } if($count > 0){ $visible=""; }else{ $visible="true"; } $json = json_encode($rows); } echo $json; ?>