문제

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?

도움이 되었습니까?

해결책

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

MySQL CURRENT_TIMESTAMP on create and on update

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top