I had been given a task to do some mini project. Right now I doing a registration, but I want to do last login date and time. When user login automatic date and time will update in the database. But i do not know, how to do it. I try doing like this and the time was have in the database but only show 0000-00-00 00:00:00. This was my SQL. I want the date and time been save same as my computer time. Hope you guys can help me ;)
<?php
session_start();
?>
<?php
require "cn.php";
$name=$_POST['Name'];
$ic_no=$_POST['Ic_No'];
$user=$_POST['Username'];
$time=date("h:i:s");
$_SESSION['CurrentUser']=$user;
$pass=$_POST['Mypass'];
$_SESSION['Currentpassword']=$password;
$email=$_POST['Email'];
$mbile=$_POST['Mobile_No'];
mysql_query("insert into reg (name,ic_no, user, pass, email, mbile,time) values
('$name', '$ic_no', '$user', '$pass', '$email', '$mbile', '$time' )");
echo header("location: sucess.php");
?>