R
R
root092015-11-15 15:24:37
PHP
root09, 2015-11-15 15:24:37

How to implement categories on the site?

Hello, tell me how to properly implement categories on the site?
Suppose there are categories on a news site, how to implement adding several categories to one news item?
i.e. in the table in the news there is a field "categories", if you enter categories id into it separated by a comma (for example, 11,7,1,22),
then how to get, for example, all news with a category with id 1 in the future?
a query like
"WHERE categories LIKE '%1%'"
will also return news with a category for example 11

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Deodatuss, 2015-11-15
@Deodatuss

third table with 2 fields category_id post_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question