Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Location
    Norway
    Posts
    26

    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
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    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.
    Code:
    users(UserID, FirstName, LastName)
    clocks(ClockID, DateTimeIn, DateTimeOut, UserID)
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    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

    User
    UserID PK
    FName
    SName....etc

    ClockEvent
    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
    Location
    In front of the computer
    Posts
    15,579
    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.

    -PatP

Posting Permissions

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