You will probably need a color table with, say, 20 colors, the clients can use to filter the products.
Here is one rather simple database design where a product has various colors:
table color - these are the generic colors used for filtering
table product - the product (irrespective of its colors)
table product_color - the product's colors; these are the items that are actually ordered
(That may get more complicated when the product has various sizes, too.)
For storing color in database use input type color if you want to store colorcode in html.
And in sql 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
如果仅使用0xRRGGBB格式,而不是在数据库中以整数形式存储,并且在要选择时以十六进制形式存储,或者如何将值存储在数据库中取决于它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.