Help finding and displaying missing record weeks

I have a page that will pull data, based on user input page by date (month and year).
And list all the classes that took attendance for that time period chosen.
So if a class took attendance in week1, week2, not week3, and week4 I need to pull a report that would show the classes that didn’t record attendance on that week.

<?php  
  {
 include 'db_connection2.php';
        
    $stmt = $pdo->prepare( " SELECT  
        
  g.name as `group`,
  DATE_FORMAT(ar.date, '%Y-%m-%d') as `date`,
  FLOOR((DayOfMonth(ar.date)-1)/7)+1 as 'week_number'

 FROM 
   attendance_record ar
   
   INNER JOIN
   _person p
   ON ar.personid = p.id
   
   INNER JOIN
   _person_group g 
   ON ar.groupid = g.id
   
-- WHERE
AND
month(date) = ? AND year(date) = ?

GROUP BY g.name, ar.date, week_number
ORDER BY g.name, ar.date ASC
                 ");
                 
$stmt->execute([$_POST["month"],$_POST["year"]]);
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);


/* $row_count = $stmt->rowCount();  
echo "<p align='center'> <font color=black  size='3pt'>Total Request&nbsp;&nbsp; $row_count </font> </p>"; */

     //-----------------------------Table------------------------------------// 

        $output .= '  
           <table id="sections1">
                <tr>  
                              <th>Class</span></th>
                              <th><span>Date</span></th>
                              <th><span>Week</span></th>
                  </tr>  
                
                     ';
                   
                foreach($result as $row)
       
            {
                $output .= '  
                     <tr>  
                           <td>' . $row['group'] . '</td>
                           <td>' . $row['date'] . '</td>
                           <td>' . $row['week_number'] . '</td>
                     </tr>
       ';
            }
      
        $output .= '</table>';         
  }
                 echo $output;
         
   $pdo=null;
    // By this way you can close connection in PDO.  
 ?>

So according to the report, Childrens Church did not do attendance on 2019-05-19.

How do I code this page to only show the classes that didn’t record attendance?

Sponsor our Newsletter | Privacy Policy | Terms of Service