Timestamp?
Posted: Mon Jun 30, 2003 6:31 am
I have a minor problem with timestamp in database. Every time user logs in, the timestamp should be updated, but it does not. Why?
When i echo the timestamp it never changes.
Code: Select all
<?php
$query_string = "SELECT * FROM users WHERE user='$username' AND pass='$password'";
$query = mysql_query($query_string) or die(mysql_error());
if(mysql_num_rows($query) != 0) {
while($row = mysql_fetch_array($query)) {
$_SESSION['lastlogin'] = $row['lastlogin'];
$_SESSION['user'] = $row['user'];
}
$_SESSION['login'] = "true";
$now = date("D.M.Y. H:i:s");
$timestamp = mysql_query("UPDATE users SET lastlogin='$now' WHERE user='$user'") or die(mysql_error());
header("location:index.php");
} else {
header("location:index.php?id=e1");
}
?>