GOsha
GOsha

Reputation: 689

how not to update timestamp field

project is written on php.
There is timestamp field in mysql it updates automatically. In one case I don`t need update this field. Can I gibe instruction not to update this field in this queries without getting timestamp value.

Upvotes: 1

Views: 301

Answers (2)

Aaron Butacov
Aaron Butacov

Reputation: 34367

Edit the column in phpMyAdmin and unselect the option for "on update current timestamp."

Upvotes: 1

Sarfraz
Sarfraz

Reputation: 382806

You should change it to DEFAULT CURRENT_TIMESTAMP otherwise it will auto-update. From the manual:

In a CREATE TABLE statement, the first TIMESTAMP column can be declared in any of the following ways:

With both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses, the column has the current timestamp for its default value, and is automatically updated.

With neither DEFAULT nor ON UPDATE clauses, it is the same as DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.

With a DEFAULT CURRENT_TIMESTAMP clause and no ON UPDATE clause, the column has the current timestamp for its default value but is not automatically updated.

Upvotes: 4

Related Questions