Home >Backend Development >PHP Tutorial >When a post has multiple tags, what is the best way to save it in the database? What should I do when I pick it up?

When a post has multiple tags, what is the best way to save it in the database? What should I do when I pick it up?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-06 13:51:121232browse

Pictured:
When a post has multiple tags, what is the best way to save it in the database? What should I do when I pick it up?

A post has 3 tags, how to save it in the database?
If the tag ID is saved, for example: 1-2-3
How to check it when querying?
Using like matching does not work!

Reply content:

Pictured:
When a post has multiple tags, what is the best way to save it in the database? What should I do when I pick it up?

A post has 3 tags, how to save it in the database?
If the tag ID is saved, for example: 1-2-3
How to check it when querying?
Using like matching does not work!

type = 1,2,3
select * from article where FIND_IN_SET('2',type)
How?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn