Click here to Skip to main content
15,892,965 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have 2 buttons On my page IN and Out according to indian time my shift is at 6pm but it overs at next date 3am.

I have to update out time where username and date are same as on IN button Click. But at 3am date gets change and data does not match,how could I solve this problem.

Please help,solution urgently required.
Posted
Updated 14-Sep-10 0:45am
v3
Comments
Sunasara Imdadhusen 14-Sep-10 6:31am    
Why you are update the records based on user name and date? instead of that you have to update only out time according to unique id.
CPallini 14-Sep-10 6:31am    
I can't understand. Could you please elaborate and give a better example? Could you please remove the 'urgent' requirement?
:-)
mohangbits 14-Sep-10 7:16am    
the difference between OUT and IN gives u 9hrs !! what else do u want :P

I think what he is trying to make is a logging system where a user would log-in and insert such as a row to a log-table. Such user should also log-out and update the row he just logged out and place a log-out time. The difference between the time will later be used to calculate the user's work time, etc.

Here is a solution.
First, place a STATUS on your row after you log-in like 'R' to mean RUNNING. Second, when the user log-in again accidentally, he should be informed that he has already logged and if 24 hours has elapsed -- that he forgot to log-out and the previous row will be deleted or cancelled from the database. In this case, you could change the STATUS to 'C' or delete it outright (if you're evil). Third, when the user logs out search if he has a running time that is within the same day as the current day. If so, get the row and update it to place the log-out time as well as changing the STATUS to 'F' - Finished. Otherwise, tell him that he did not log-in for the day, so there's no point in logging out.

Get only one clock so that there is no problem with the date retrieval. Do not update based on date and id, update it based on id and STATUS.

I hope this helps
 
Share this answer
 
i cant understand ur question , pls post ur code here or ask ur question clearly?
 
Share this answer
 
Comments
#realJSOP 14-Sep-10 7:26am    
DO NOT USE TEXT SPEAK HERE.
Per Söderlund 14-Sep-10 8:49am    
I agree,this is not an answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900