我想节省时间,当用户注册。这是我的表数据
nic name age time
190 ali 27 2012-04-13 17:31:19
217 bilal 32 2012-04-15 02:00:40
382 hamza 21 2012-04-17 20:59:29我在MYSQL中手动创建了时间属性
Column : time
Type TIMESTAMP
Default : CURRENT_TIMESTAMP
attributes: on update CURRENT_TIME现在我想永久保存这段时间..当注册用户更新他的个人资料时,时间会自动更新。
有没有办法不改变时间的更新,我只是想永久保存时间,当用户注册,而不是改变它的任何类型的更新
发布于 2012-04-18 00:18:25
不要指定ON UPDATE CURRENT_TIMESTAMP。相反,应该只依赖于DEFAULT CURRENT_TIMESTAMP,并在INSERT语句中省略该列。
通过包含ON UPDATE规范,您可以强制时间戳列在行发生更改时进行更改。你不需要那个。
/* Omit the time column on insert: time will get the default value. */
INSERT INTO user (nic, name, age) VALUES ('newuser', 'New user Name', 33);https://stackoverflow.com/questions/10195028
复制相似问题