D
D
Dmitry Kuznetsov2016-03-02 22:12:28
MySQL
Dmitry Kuznetsov, 2016-03-02 22:12:28

How to create multiple categories for news?

Good day to all!
I'm doing my project (on Laravel 4) and I needed the ability to display news with several categories.
There are 2 tables:
category :
id_category - Category ID
title_category - Category name
news:
id_news - News ID
title_news - News Title
category_news (VARCHAR) - Category ID
And how should I do it in general? Thanks in advance for your advice.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-03-02
@alexey-m-ukolov

Since you have a many-to-many relationship , you need to make a separate table where news_id, category_id will be stored.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question