TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-04-2009, 10:28 AM   #1 (permalink)
The Visitor
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Vartan is on a distinguished road
Book My first PHP project

Hey guys, i got a few question that i hope to get answered here so i hope i don't take too much of you time :)

basically this would be my first php "project" if you can even call it that :)
just as a side note my php coding knowledge is basic at most and i'm still learning...

The Theory part:
I wish to make a page that tracks the work time of several people and displays some information about it in real time on the same page.

The practical part:
2 buttons - Start and end work day. that allow me to start the counting the how much time has passed from the moment the work day started

1 Text field + add button - to be able to add works before and during the work day (if some one for example joined mid way.

1 table to display all the data.


Now for the questions:
How should i go about making this?
can this be done with php by it self or do i need to use something like AJAX?
will i need a MySQL database?

thank you in advance
Vartan
Vartan is offline  
Reply With Quote
Old 11-04-2009, 11:33 AM   #2 (permalink)
The Acquainted
 
captainmerton's Avatar
 
Join Date: May 2009
Posts: 178
Thanks: 9
captainmerton is on a distinguished road
Default

Depends - I would suggest using a mysql database but if you dont have that you just need to:

1. Use something to identify the user (a cookie perhaps)
2. Store the start and end time in a file when the buttons are clicked you can use a php function to get the time on the host server

I'd use mysql if i was you but what you are suggesting sounds pretty straight forward.
captainmerton is offline  
Reply With Quote
Old 11-05-2009, 03:07 PM   #3 (permalink)
The Visitor
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Vartan is on a distinguished road
Default

was hoping to get some more input on this...
Vartan is offline  
Reply With Quote
Old 11-05-2009, 05:59 PM   #4 (permalink)
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
Old 11-06-2009, 07:34 AM   #5 (permalink)
The Contributor
 
Join Date: Feb 2009
Posts: 65
Thanks: 0
Krik is on a distinguished road
Default

Thought I would throw your way some good reference material. If you don't know about php.net look them up and then do a search for the date() time() mktime() and strtotime() functions. And as a database is needed you can look up the mysql functions. They have tons of examples and user input, for all the php functions, that can be of great help if your just getting started.

Even after 10+ year of web design I always am looking things up on their site.

Also I hope your web host has phpmyadmin for you to use as it will make the initial setup of the MySQL data base a breeze as well it has some nice features that may help you learn to work with MySQL.

After that google, the number of times I have searched for "php somefunction" to find good examples of how to use some functions is innumerable.

As far as using AJAX, I would say if your not proficient with both PHP and Javascript and debugging them then steer away from it for now.

What your trying to do is fairly straight forward. I believe my first php was of a similar nature. I think as recent as a few months ago I used that script (obviously updated for php changes).

After looking up those functions and you have something as far as working code that we can look at I am sure many here can help you in much more detail.
Krik is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Your Biggest PHP Project hello-world The Lounge 6 10-30-2012 09:36 AM
10 PHP Myths Dispelled Wildhoney General 9 06-15-2009 06:55 AM
Freelance Suite: Client & Project Management Software CLCook Show Off 2 09-14-2008 10:50 AM
PHP project for a business environment - ideas? MovingShadow General 2 09-01-2008 04:29 PM
PHP Compressor Kalle Script Giveaway 8 05-28-2008 12:14 AM


All times are GMT. The time now is 09:31 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design