开发者

mysql timestamp updates when record is amended

I raised a question about this a while ago but I'm still having an issue. I have a mysql5 database with a sales table that contains a timestamp to represent a sale. If a field in the sales table in amended or altered the timestamp updates to开发者_如何转开发 the current time (the time of the change). To prevent this I have unselected the on_update_select_current_timestamp option but still the timestamp changes?

Here's how the field looks in phpmyadmin

mysql timestamp updates when record is amended

Does anyone have any idea what I should do, unchecking the CURRENT_TIMESTAMP option seems to reset the on_update_select_current_timestamp trigger


if you don't want this field to be updated automatically, just do not use timestamp type field at all
Use datetime instead.


Check the table definitions, if the CURRENT-TIMESTAMP option is really disabled.

If its disabled, it should look like...

CREATE TABLE `sometable` (
  ...somefields...
  `Sale_Time` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' INT(11) DEFAULT NULL,
  ...somefields...
) ENGINE=someengine

...otherwise the CURRENT-TIMESTAMP would be visible in this line. When it is disabled, it doesn't update on an update, unless some other database function (Trigger or such) changes it while updating fields.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜