Please excuse what may be a simple question from a relative newbie!
I have a table in my database which has the following fields/data types
id - integer
admin - integer
date - date
am - varchar
pm - archer
I am trying to work out what sort of MySQL query I could use to display the attendance marks for a complete week on each row of the table.
I can currently achieve something close but by using a separate table for each day of the week and having the 5 tables displayed side by side - but I am sure there must be a way of having it displayed in a single table, just can't figure it out!
Attachedis a screenshot of what I can achieve currently:
Hopefully someone would be kind enough to point me in the right direction.
The code I am currently to return data for single day is as follows:
$student_attendance_monday_query = "SELECT am, pm
FROM attendance_15_16
WHERE DATE_FORMAT(date,'%W')='Monday' AND admin = '" . $admin . "'
";
$student_attendance_monday_results = mysqli_query($link, $student_attendance_monday_query);
while ($row = mysqli_fetch_array($student_attendance_monday_results)) {
$mon_am_new = $row['am'];
$mon_pm_new = $row['pm'];
echo "<tr>
<td>" . $mon_am_new . "</td>
<td>" . $mon_pm_new . "</td>";
};