【发布时间】:2017-08-23 01:46:29
【问题描述】:
我已经开始学习 php 和 mysql,目前我正在考虑如何存储和检索某些产品的标签。
我想为指定的产品分配标签,然后使用 while 方法或类似方法进行显示
在第一步我想将它存储在一个字段中,但我不知道如何将每个单词都作为单一项目检索。
CREATE TABLE `products` (
`id` int(11) NOT NULL,
`brand_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
`product_name` text COLLATE utf8_unicode_ci NOT NULL,
`product_description` text COLLATE utf8_unicode_ci NOT NULL,
`product_keywords` text COLLATE utf8_unicode_ci NOT NULL,
`product_image` text COLLATE utf8_unicode_ci NOT NULL,
`product_specification` text COLLATE utf8_unicode_ci NOT NULL,
`product_spec_link` text COLLATE utf8_unicode_ci NOT NULL,
`product_webstie` text COLLATE utf8_unicode_ci NOT NULL,
`status` text COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
有什么想法吗?
我在这里读到,最好的方法是为此目的创建单独的表并将它们分配给特定的产品 ID,但目前我无法想象,当我想为其添加新标签时它将如何工作。
【问题讨论】: