I have an INT (11) column for storing the current timestamp in seconds. The query looks like:
INSERT INTO `abc` (id, timestamp) VALUES ('', UNIX_TIMESTAMP ( NOW () ) )
I don’t know why, but the date isn’t changed. It doesn’t matter when I send the query, the column value isn’t changed. It has 1342692014 value, but I don’t know why.
Is there any option or other function for timestamps? I must store dates in seconds.
You never refer to the
timestampcolumn in your query. You only have a string:Edit:
I get this with your updated code:
Assuming it’s not still the actual code and after fixing the syntax error, I can’t reproduce your results. My educated guess is that
idis an auto-incremented integer primary key, your current SQL mode is making MySQL take''asNULLand inserting a new row… But I haven’t really tested this hypothesis.My working code is this:
… and returns this: