Page 1 of 1

Clock In/out function

Posted: Tue Dec 13, 2011 2:37 am
by Rezzi
I need help with my coding.

So far what i have done is the clock in and out function and the code is

Code: Select all

<?php
include "dbfunctions.php";
(date_default_timezone_set("Asia/singapore"));
$date =date("Y-m-d H:i:s");

			$query = "INSERT INTO time(clockin) VALUES ('".$date."')";
			$result = executeInsertQuery($query);
echo "$date";
?>
The problem is the clock in/out needs to be created in the same record and not 2 different records in the database.
Please help thanks!!

Re: Clock In/out function

Posted: Tue Dec 13, 2011 7:58 am
by social_experiment
To update records you need a field specific to the record you want to update, something unique to only one record in the table, username, userid etc

Code: Select all

UPDATE mytable SET field = value WHERE id = 2
In the example above it is the value contained within the 'id' field of the table

Re: Clock In/out function

Posted: Tue Dec 13, 2011 9:26 pm
by Rezzi
Thanks! i will see how to do it