Store CSS color values in DB

Hommer Smith picture Hommer Smith · Nov 29, 2012 · Viewed 11.2k times · Source

I need to store a CSS HEX color value (#FFFFFF for example) into a mysql database.

Which type of data would I use and why it would be better over using another one?

Answer

silly picture silly · Nov 29, 2012

save the color with a char(6) without the # if the column is not null... if the column is nullable use a varchar(6) to saving size