in reply to Bug on MySQL? timestamp problem
Straight from the MySQL manual:
The TIMESTAMP column type provides a type that you can use to automatically mark INSERT or UPDATE operations with the current date and time. If you have multiple TIMESTAMP columns, only the first one is updated automatically. Automatic updating of the first TIMESTAMP column occurs under any of the following conditions: 1. The column is not specified explicitly in an INSERT or LOAD DATA INFILE statement. 2. The column is not specified explicitly in an UPDATE statement and some other column changes value. (Note that an UPDATE that sets a column to the value it already has will not cause the TIMESTAMP column to be updated, because if you set a column to its current value, MySQL ignores the update for efficiency.) 3. You explicitly set the TIMESTAMP column to NULL.
Try using a DATETIME type and when you insert pass it a value of NOW(). Do not use a placeholder for this particular column or it will attempt to pass NOW() as a string. Also, you can do set timestamp_field=timestamp_field in your update query if you don't wish to alter the table structure.
Hope this helps.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
|
---|