Page 1 of 1

Timestamp?

Posted: Mon Jun 30, 2003 6:31 am
by Czar
I have a minor problem with timestamp in database. Every time user logs in, the timestamp should be updated, but it does not. Why?

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");
}
?>
When i echo the timestamp it never changes.

Posted: Mon Jun 30, 2003 7:05 am
by Czar
...does not work after all...

what to do?

Posted: Mon Jun 30, 2003 7:20 am
by Czar
Got it. There was a wrong parameter in UPDATE row.