Best field type for storing various of data to MySQL table.

IP address:

Use: INT 4 Unsigned

Convert the IP address to 32-bit unsigned integer before storing it to table.
You can use built in MySQL INET_ATON() and INET_NTOA() function to convert this.
Sample:

INSERT INTO table SET ip = INET_ATON('192.168.0.1')

------------------------------

Unix timestamp:

Use: INT

------------------------------

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

If you enjoyed this post, make sure you subscribe to our RSS Feed! Or if you prefer, you can Follow us on Twitter instead.

This is my notes page -- a scratch pad. Sometimes I do not write them correctly. I wrote here so I can access my notes from everywhere. If you want to use them, use with caution. Please check and re-check the syntax. You've been warned!