Looks fine to me, what about you? It works. The problem is it keeps inserting 255 as the timestamp. I even tried to substitute php's time() function with mysql's own native unix_timestamp(), and it still inserted 255.
I can't find any sites that document this happening, so no luck in fixing it so far.
The table column it's going into is an unsigned tinyint(11) which is the same as I've always used for my timestamps.
An UNSIGNED TINYINT column can contain a maximum value of 255. The number in parentheses is only for the display width of the column and has no effect on the range of values that can be stored in it. Since timestamps are integers like 1208895830 they are way, way out of the accepted range of values (-128–127 signed; 0–255 unsigned) and therefore they get truncated to 255.
You should use an appropriate column type (either DATETIME or TIMESTAMP) to store the timestamps and use the available MySQL functions (FROM_UNIXTIME, UNIX_TIMESTAMP) to convert between the integer Unix Timestamp and other representations.
The Following User Says Thank You to Salathe For This Useful Post: