Forum Moderators: coopster
Can anyone help, im writing a record keep ing app in php using a mysql backend. One part i am now stuck on is keeping track of weekly attendance
The system will be used by our local scout group so what i need is to be able to record who attended each week
I have a table containing names of all members but not sure what to do about the attendance table or its structure, can anyone please help
thanks
table meeting contains:
meeting_id
meeting_date
- anything else worth storing
table attendance contains:
meeting_id
scout_id
This is assuming you've given IDs to your scouts... Otherwise you could use their names, but IDs are a good habit to get into. Insert a record in attendance for each one that attends. Easy :)
If you wanted to find out who attended, you can query it, a missing record shows the person hasn't attended. The tables can be beter normalized if events are registered in a separate table and attendance table just holds event_id.
I hope this just gives you a hint.
You could make a 'matrix' to display all the dates with all the names with checkboxes for each matchup. Here's some pseduo code to get you going.
Select * from meeting
Create array of meetings
foreach meeting
> Create table column headers with the dates
Select * from scouts
while there are more scouts
> Create table row header with scout name
> foreach meeting
> > create table cell with check box
end while
That's about it for displaying the matrix.
If you name all the check boxes "attendance[]" with values such as 'meeting_id-scout_id' (which will end up looking like '1-1','17-12' etc.) on the next page you'll get an array with all the meeting-scout match ups that are checked.
Then you can process them all and add or remove the required meeting-scout matches. Keep in mind that this method only tells you the scouts that have attended, not those that haven't, so to remove attendances (that were incorrectly marked as attended previously) you'll need to delete all the values from the attendance table and re-insert them.
Good luck!