I want to add the current date when a user is logged in on my system, however it doesn't seem to work!
if (password_verify($_POST['password'], $password)) {
session_regenerate_id();
$_SESSION['loggedin'] = TRUE;
$_SESSION['name'] = $_POST['username'];
$_SESSION['id'] = $id;
$query = " INSERT INTO accounts (last_login) VALUES (SYSDATE()
);WHERE `id`='".$id."'";
header('Location: home.php');
The field last_login field in MySQL is set to datetime. Now what happens is that it redirects the user to home.php, however nothing is written in the DB!