I really want the data in my database to be in the same row.
My problem is that when I submit the start time the end time automatically becomes like this: 00:00:00
Here is my code:
<?php
//Connect and select a database
mysql_connect("localhost", "root" , "" )or die("cannot connect to database server");
mysql_select_db("dbdorm")or die("cannot select the database");
//if form is submitted
if(isset($_POST['submit']))
{
date_default_timezone_set('Asia/Manila');
$query = "INSERT INTO datetime (starttime) VALUES(NOW())";
$submit = mysql_query($query) or die("insertion error");
header("location:loggedin.php?");
}
else{
date_default_timezone_set('Asia/Manila');
$query = "INSERT INTO datetime (endtime) VALUES(NOW())";
$submit2 = mysql_query($query) or die("insertion error");
header("location:loggedin.php?");
}
?>