query( "SELECT branch_id, branch_name FROM branch WHERE deleted_at IS NULL " ) ; if ( $get_branch->num_rows > 0 ){ while ( $row_branch = $get_branch->fetch_assoc() ){ $branch_all[$row_branch['branch_id']] = $row_branch['branch_name'] ; } } $month_3_ago = date( "Y-m", strtotime( '-2 months' ) ) ; $month_2_ago = date( "Y-m", strtotime( '-1 months' ) ) ; $month_1_current = date( "Y-m", time() ) ; $mysqli_staff = $mysqli->query("SELECT staff_id, staff_name, staff_idno, staff_date_resigned, branch_id FROM staff WHERE deleted_at IS NULL AND staff_idno IS NOT NULL AND ( staff_date_resigned LIKE '%".$month_3_ago."%' OR staff_date_resigned LIKE '%".$month_2_ago."%' OR staff_date_resigned LIKE '%".$month_1_current."%' ) ORDER BY staff_date_resigned ASC") ; $staff_list = [] ; if ( $mysqli_staff->num_rows > 0 ){ while ( $row_staff = $mysqli_staff->fetch_assoc() ){ $reset_month = date( 'Y-m', strtotime( $row_staff['staff_date_resigned'] ) ) ; $staff_list[$row_staff['branch_id']][$reset_month][] = $row_staff ; } } $html = '' ; if ( count($staff_list) ){ foreach ( $staff_list as $kbranch => $vbranch ){ $html .= '
| No. | ID No. | Staff Name | Resigned Date |
|---|