If table field is defined as timestamp
, then it'll update automatically when record is changed / updated.
Read more about timestamps and issues here:
http://dev.mysql.com/doc/refman/5.1/en/timestamp-initialization.html
Question
Date, time resets every time i use UPDATE,
page1
mysql_query("INSERT INTO table (time) VALUES(CURRENT_TIMESTAMP()) ") or die(mysql_error());
page2 (not connected with page1)
echo $row['time'];
and after i use
$query = mysql_query("UPDATE tablica SET views = views+1 WHERE id = '".$id."' ");
date and time resets to current date and time and if i delete UPDATE code everything is fine, type is timestamp, how to stop reseting date and time?
Solution
If table field is defined as timestamp
, then it'll update automatically when record is changed / updated.
Read more about timestamps and issues here:
http://dev.mysql.com/doc/refman/5.1/en/timestamp-initialization.html