Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006

    Unanswered: need help creating a punch clock system

    i am trying to set up a mysql db for a simple punch clock system but i am unsure what is the best way to go about it.

    it is just going to be a web interface with php, with an "in" button and an "out" button. and i just need the time a day when each individual clicks either button.

    so i am thinking:
    punch_clock(name, in, out)
    is this going to be good enough??

    i am not very good with db's but i would like to do it right... and as simple and clean as possible.

    anybody know how i can set up a simple punch clock table/db???

  2. #2
    Join Date
    Jan 2007
    Provided Answers: 12
    Quote Originally Posted by demiurgen
    punch_clock(name, in, out)
    Ok, let's think of it this way.
    Today I clock in at 10am and out at 2pm.
    I do the same tomorrow.
    Quote Originally Posted by georgev
    George 10/06/2007 10:00 10/06/2007 14:00
    George 11/06/2007 10:00 11/06/2007 14:00
    I just violated your primary key.

    You may wish to consider using a foreign key relationship.
    Something like this may be acceptable depending on your requirements.
    users(UserID, FirstName, LastName)
    clocks(ClockID, DateTimeIn, DateTimeOut, UserID)
    Home | Blog

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    do you need to consider people who forget to clock in or out? if so how does your model allow for the fact that a retrospective adjustment is being made?

    it depends on your requirements but do you want to have to look for a previous clock on to register a clock out event.

    at first glance Id be looking for at least 2 tables

    UserID PK

    EventID PK
    UserID FK in User
    EventTimeStamp 'the time the event occurred according to the clock
    ChangedBy 'something to record WHO/WHAT made changed (optionally FK to User)
    RowTimeStamp 'date this row was last edited/changed (should be the same as the EventTimeStamp

    you could if you required to also store an event type int he clockevents (eg IN, OUT, IN [adjusted], Out [Adjusted], OnBreak, OffBreak etc......)
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    Is there a reason that you don't use one of the existing time clock routines? I think I've seen 10,000 posted in various source code archives over the last few years.

    I'm too lazy to reinvent the wheel, unless I truly need a custom wheel for some reason.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts