Re: mysql timestamp field
| From: | Doug Granzow | Date: | Fri, 07 Sep 2001 13:03:12 +0000 |
| Subject: | Re: mysql timestamp field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66404@lists.php.net to get a copy of this message | ||
The timestamp data type is a special MySQL type that automatically updates
whenever you add or update a row in a table.
If you want timestamp to work when you add a row but not when you update a
row, you need to write your update statements like this:
UPDATE tbl_name SET vartochange="newvalue", t_stamp=t_stamp WHERE ...
The "t_stamp=t_stamp" will cause t_stamp to not change to now().
Doug Granzow
dig@cynosure.net
"Mesut Tunga" <mesut@tunga.com> wrote in message
news:3B9783A7.EAE8E186@tunga.com...
> Hi all,
>
> I need an update on my table. but I have a timestamp field called
> t_stamp. When I update a field other than t_stamp field, t_stamp field
> also updates to now(). I need it not to update and saves its value.
>
> How should I do this?
>
> Regards
> Mesut Tunga...
>