Forum Moderators: coopster

Message Too Old, No Replies

Create attendance register

         

johnboy4809

10:02 am on May 22, 2008 (gmt 0)

10+ Year Member



Dear all

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

MattAU

10:07 am on May 22, 2008 (gmt 0)

10+ Year Member



There are a couple of options - creating a "meeting" table or not... I'd suggest going with creating one. Then you make a table to join the meeting and the scouts.

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 :)

Habtom

10:13 am on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



members table => id, member name, . . . other fields
attendance table => id, a_date, member_id, . . . more fields

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.

Habtom

10:14 am on May 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MattAU beat me on this, the above two posts can give you a good start.

johnboy4809

10:19 am on May 22, 2008 (gmt 0)

10+ Year Member



thanks guys

thats great will get on with this, just couldnt get my head around it at first. And yes all me members names have IDs was going to use these to link the tables

thanks again

johnboy4809

12:38 pm on May 22, 2008 (gmt 0)

10+ Year Member



hi guys again

im just wandering how i would go about now populating a table listing all the scouts names then colums of the dates we now entered in the meetings table, and the cells contain a check box to say if they had attended or not

thanks

john

MattAU

12:08 am on May 23, 2008 (gmt 0)

10+ Year Member



By populating a table I'd assume you mean an HTML table? You need to be fairly specific with your questions because table would usually mean database table when we're talking about databases... :)

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!