Page 1 of 1

[SOLVED] MySQL timestamp INSERT successful only some of time

Posted: Sat Jan 29, 2005 1:16 pm
by voltrader
- TIMESTAMP column in the table created
- PHP's time() used to get unix timestamp
- I echo out the MySQL statement before doing the INSERT, which shows time() being inserted

Problem I run into is that time() only inserted successfull in db about 50% of the time. Other records still have the default 14 zeros. There are no errors displayed.

Not sure where to look...

Posted: Sat Jan 29, 2005 1:39 pm
by timvw
which is the mysql version you are using?

what is the exact query? as you are generating a unix timestamp, do you use the from_unixtime function?

Posted: Sun Jan 30, 2005 11:08 pm
by voltrader
Thanks for the reply... figured it out: TIMESTAMP automatically timestamps any INSERT. I was writing over the TIMESTAMP by mistake.

Posted: Mon Jan 31, 2005 1:04 am
by timvw
btw, timestamps behaviour differs in versions <4.1 and more recent...