Re: Setting date as default value

From: Date: Tue, 20 Jun 2000 19:29:24 +0000
Subject: Re: Setting date as default value
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-522@lists.php.net to get a copy of this message
on 6/20/00 2:09 AM, php3@developersdesk.com at php3@developersdesk.com wrote: Thanks, those are good solutions. -- Randy Perry rgp systems Mac Consulting/Sales > > Make enter_date type TIMESTAMP. > > > See section 7.2.6 Date and Time Types in the MySQL manual for more > details. > > > or when you add an entry > > INSERT INTO customer SET > enter_date = NOW(), > ... > > > If you use 1 and only 1 TIMESTAMP in your field it will be changed to > the current time EVERY TIME THE RECORD IS UPDATED. If you use more > than one only the first is updated. I usualy use this feature by > having two (or more) TIMESTAMP fields in the record: > > > Modified TIMESTAMP, > Created TIMESTAMP, > > You have to set Created = NOW() when you create the record, I usually > set Modified too, but even if you don't the 'first timestamp is set to > NOW() when the record is updated' rule will set it. (I have a policy > of setting every field in the table when I do an INSERT. > > > > > > > > > Rick Widmer > Internet Marketing Specialists > www.developersdesk.com >

« previous php.db (#522) next »