Jump to content

Recommended Posts

I have a database of timecards, looks like this:

 

userid start time end time totalmins lunch lunchmins

 

Everytime an employee punches in/out it creates a new entry.

 

Example - Employee started at 8AM, went to lunch at 12PM, at lunch for 30mins, returned at 1230PM, went home at 430PM.

1 2013-02-21 08:00:00 2013-02-21 12:00:00 240 1 30

1 2013-02-21 12:30:00 2013-02-21 16:30:00 240 0 0

 

I have 2 entries for every employee, every work day since Jan 2nd.

 

Now I made a change, the database looks like this using the same example above

 

userid start time end time totalmins lunchout lunchin lunchmins

1 2013-02-21 08:00:00 2013-02-21 16:30:00 510 2013-02-21 12:00:00 2013-02-21 12:30:00 30

 

Now I have 1 enrty per employee, per day.

 

 

Question, how do you think I could take the old entries and combine them into 1 entry using the new format???

 

Example from data above

 

Start time is fine, in same entry lunchout needs to be the checkouttime from the old data, lunchin needs to be the checkintime from the old data (2nd entry from the same day), and the checkout time needs to be checkouttime from the old data (2nd entry from the same day).

Link to comment
https://forums.phpfreaks.com/topic/274791-php-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.