Re: timestamp triggered only on update?

From: Date: Thu, 25 Jul 2002 22:35:22 +0000
Subject: Re: timestamp triggered only on update?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109616@lists.php.net to get a copy of this message
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: ragnar@chello.no (Ragnar) > Organization: na > Reply-To: "Ragnar" <ragnar@chello.no> > Newsgroups: php.general > Date: Fri, 26 Jul 2002 00:19:02 +0200 > To: php-general@lists.php.net > 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 > >

« previous php.general (#109616) next »