Re: inserting timestamp into mysql field
| From: | Chris Dowell | Date: | Wed, 22 Sep 2004 08:29:21 +0000 |
| Subject: | Re: inserting timestamp into mysql field | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197535@lists.php.net to get a copy of this message | ||
That's not 100% correct
If you have more than one TIMESTAMP field only the first (IIRC) will be filled with the current time - other TIMESTAMP fields will only be filed if you set them = NULL.
This is true of MySQL < 4.1.2 - there is more fine-grained control over the behaviour from 4.1.2 onwards.
Note that for < 4.1.2 the first TIMESTAMP field will also be automatically set on UPDATE.
Hope this helps
Cheers
Chris
Andrew Kreps wrote:
On Tue, 21 Sep 2004 16:25:37 +0100, luke@lukem.co.uk <luke@lukem.co.uk> wrote:i need to insert a current timestamp into a mysql field when a form is posted. can anyone suggest a simple way of doing this?Here's the MySQL answer: If you have a (data type) timestamp field in your table, you don't need to do anything. MySQL will automatically fill it in on insert, and update it when you run an update query.