View Single Post
Old 11-05-2009, 05:59 PM   #4 (permalink)
Sirupsen
The Contributor
 
Sirupsen's Avatar
 
Join Date: May 2009
Posts: 53
Thanks: 2
Sirupsen is on a distinguished road
Default

You can probably, do it entirely with PHP. Having a button you click which creates a row in your database like:

[ID: 1][Start: 1257443698][End: /Empty/]

When you click the button again, it would put the end time on the newest entry (one with highest id, or you could take the one with the most recent "Start):

[ID: 1][Start: 1257443698][End: 1257443720]

From there's it's pretty easy to calculate the difference. :)
However, this method is not really awesome. It's more cool to be able to follow it "live", so you can always see for how long you worked. Like a stopwatch. You would need some Javascript for this. It could be done like this:
Click Start.
Begins counting in seconds..
Click Stop.
AJAX which puts the session into the database, i.e.:

[ID: 1][Date: 1257443698][Time(Seconds): 732]

From there it's also pretty easy to play with! :)

I'm not entirely sure what you mean by the other ones, but I hope above can work out for you! The code should be pretty simple, and you learn best by doing it yourself, and then get support here.
Send a message via AIM to Sirupsen Send a message via MSN to Sirupsen Send a message via Yahoo to Sirupsen Send a message via Skype™ to Sirupsen
Sirupsen is offline  
Reply With Quote