PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Rezzi
Forum Newbie
Posts: 2 Joined: Tue Dec 13, 2011 2:30 am
Post
by Rezzi » Tue Dec 13, 2011 2:37 am
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!!
social_experiment
DevNet Master
Posts: 2793 Joined: Sun Feb 15, 2009 11:08 am
Location: .za
Post
by social_experiment » Tue Dec 13, 2011 7:58 am
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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Rezzi
Forum Newbie
Posts: 2 Joined: Tue Dec 13, 2011 2:30 am
Post
by Rezzi » Tue Dec 13, 2011 9:26 pm
Thanks! i will see how to do it