will2002 Posted October 9, 2008 Share Posted October 9, 2008 Hi Im pretty new to php and i am attempting to create a php/mysql application to store employees weekly hours worked ie. a timesheet. I have developed basic address books using php/mysql so i am familiar with storing and retrieving data. My main problem is trying to figure out how to store a new piece of information on an employee every week whithout over writing last weeks record. ie every week a new timesheet but also being able to record previous weeks timesheets. Any application i have previously created has been one entry for each record eg name address etc. things that dont change every week. Any suggestions at all would be greatly appreciated Sorry if i have over complicated what is probably a pretty basic problem. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 9, 2008 Share Posted October 9, 2008 I'm assuming you have two tables, right? A timecard table and an employees table. If that's the case, do an INSERT on the timecard table and and UPDATE on the employees table. List your code and explain further what you want to do. What do you want to insert and what to you need to change in the employees table? Quote Link to comment Share on other sites More sharing options...
wrathican Posted October 9, 2008 Share Posted October 9, 2008 well, what i would do is create a table containing an entry for each employee, give them a user and pass. make sure there is an id associated with that username. create another table containing log in and out times and the userid of the person logging in and out. on successful log in send a query to the database like 'insert into table (id, in) values(1, NOW())' NOW() being a mysql datetime containing the servers current date and time at that point. do the same on log out. then when searching for a particular users log in and out time just search for thier user id in that table Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 9, 2008 Share Posted October 9, 2008 Sounds like you have it figured out. What do you need help with? Quote Link to comment Share on other sites More sharing options...
will2002 Posted October 9, 2008 Author Share Posted October 9, 2008 Thanks for the replies The employees work on a building site and have no access to a computer. They complete a timesheet each week and hand it into the office so i guess wrathican your suggestion wouldnt work for this situation thanks for posting though. I have developed a front end form which someone in the office will have to manually type the information on the timesheets into. it then saves the data in the database. the problem is is that i have only got one table and this weeks timesheet would overwrite last weeks and so on. ie at the moment i can only save one time sheet for each employee where i need to be able to store all past timesheets aswell. i know i probably need a second table but im not sure how to save several timesheets for each employee as each timesheet is made up of 12 fields. Quote Link to comment Share on other sites More sharing options...
will2002 Posted October 9, 2008 Author Share Posted October 9, 2008 I have figured it out. Just going to use two tables as you said. thanks for the help Quote Link to comment Share on other sites More sharing options...
Brandon Jaeger Posted October 9, 2008 Share Posted October 9, 2008 Sounds like you have it figured out. What do you need help with? That wasn't the author that posted that Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 10, 2008 Share Posted October 10, 2008 Hehehe... uh... I knew that... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.