I believe MySQL will only automatically update one TIMESTAMP field per
record, according to their online docs. It will update if you don't specify
a value when inserting a new record. You can also use the DATETIME field
type which stores data as YYYY-MM-DD HH:MM:SS. This is what I use because
it's easier to read by humans. Date and time are inserted into all DATETIME
fields in a record automatically when set to allow NULL. You can then easily
convert this to a Unix timestamp easily using the MySQL UNIX_TIMESTAMP()
function when doing a query. PHP also has similar date/time conversion
commands.

I'm not a MySQL expert, so, the above my not be totally accurate, it's based
on my own experience.

Monty
  

> From: [EMAIL PROTECTED] (Ragnar)
> Organization: na
> Reply-To: "Ragnar" <[EMAIL PROTECTED]>
> Newsgroups: php.general
> Date: Fri, 26 Jul 2002 00:19:02 +0200
> To: [EMAIL PROTECTED]
> Subject: timestamp triggered only on update?
> 
> Maybe the wrong forum, but im giving it a try.
> 
> Im used to for instance 2 columns in each table indicating when it was
> created and when it was last updated:
> 
> Changed_date
> Registered_date
> 
> In mysql it seems it is only possible to define a column as a timestamp, and
> this will trigger both on insert and delete. Is it possible to define
> changed_date to trigger only on update in mysql or do i have do give the
> correct timestamp "manually" from php?
> 
> Thanx
> 
> -R
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to