tags:

views:

33

answers:

2

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.

+2  A: 

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.

Sarfraz
Thank you. I was using old PMA version
GOsha
+1  A: 

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

Aaron Harun
Thank for exact answer)
GOsha