我的 MySQL 数据库中有一个包含时间戳的列。无论我更新记录多少次,我的时间戳都不会更新。有什么我应该做的让它自动更新吗?
在Stackoverflow这里搜索其他问题,大部分都说反了,真的很迷茫!例如,这个, 我应该使用字段'datetime'还是'timestamp'?(查看评分最高的答案)
谢谢
这是我的表结构
+----------------+-------------+------+-----+-------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+-------------------+----------------+
| Num | int(11) | NO | PRI | NULL | auto_increment |
| mem_name | varchar(50) | NO | | NULL | |
| mem_id | int(11) | NO | | NULL | |
| car_number | varchar(11) | NO | | NULL | |
| firstcall_time | timestamp | NO | | CURRENT_TIMESTAMP | |
| tow_time | datetime | NO | | NULL | |
+----------------+-------------+------+-----+-------------------+----------------+
6 rows in set (0.00 sec)
One Record:
+-----+----------+--------+------------+---------------------+---------------------+
| Num | mem_name | mem_id | car_number | firstcall_time | tow_time |
+-----+----------+--------+------------+---------------------+---------------------+
| 1 | Jakey | 54564 | SHA34345 | 2013-02-19 16:14:12 | 2013-02-19 16:32:45 |
+-----+----------+--------+------------+---------------------+---------------------+
1 row in set (0.00 sec)
After Updating:
+-----+----------+--------+------------+---------------------+---------------------+
| Num | mem_name | mem_id | car_number | firstcall_time | tow_time |
+-----+----------+--------+------------+---------------------+---------------------+
| 1 | Tommy | 54564 | SHA34345 | 2013-02-19 16:14:12 | 2013-02-19 16:32:45 |
+-----+----------+--------+------------+---------------------+---------------------+
1 row in set (0.00 sec)