I have an attendance program that I’m trying to pull a report based on attendance each week by the month. There are multiple classes. Class is same as person_group.
I need to pull the report like below.
Class Date Attended
Experienced Adults ……… 2018-12-02 ………. 5
Experienced Adults ……… 2018-12-09 ….…… 5
Sr. Adults …………….……. 2018-12-02 ………. 22
Sr. Adults ……………. …… 2018-12-09 …….… 25
What I have so far.
Filter code below
<?php
//filter7_class.php
{
include 'db_connection.php';
$query = " SELECT *
FROM _person, attendance_record, _person_group
WHERE _person.id = attendance_record.personid
AND _person_group.id = attendance_record.groupid
AND attendance_record.present = 1
AND _person_group.id = 2
AND date BETWEEN '".$_POST["from_date"]."' AND '".$_POST["to_date"]."'
";
while($row = mysqli_fetch_array($result))
{
$counter++; //increment counter by 1 on every pass
}
$result = mysqli_query($conn, $query);
$num_rows = mysqli_num_rows($result);
echo "Present $num_rows";
$output .= '
<table class="table table-bordered">
<tr>
<th width="30%"><span>Class</span></th>
<th width="20%"><span>Date</span></th>
<th width="2%"><span>RunCnt</span></th>
</tr>
';
if(mysqli_num_rows($result) >0)
{
$count++;
while($row = mysqli_fetch_array($result))
{
$output .= '
<tr>
<td>'. $row["name"] .'</td>
<td>'. $row["date"] .'</td>
<td>'. $count++.$row["count"] .'</td>
</tr>
';
}
}
else
{
$output .= '
<tr>
<td colspan="5">No Report Found or No Class Selected (Check your Dates and Select a Class and try again)</td>
</tr>
';
}
$output .= '</table>';
echo $output;
}
?>