0
I am creating a project, news site, and have to make a pagination using categories and tags, a news has a category and more than one tag.
I have a table with the news posts, and I have the tables with categories and tags, what exactly I want to know, is how to relate a category and several tags to a news.
Did you create the relationship between the tables in the database? If not, you know one-to-one, one-to-many and many-to-many relationships?
– Woss
I do not know, I started a month to study php, I am creating a project to practice.
– Caymmi
Hi Caymmi, it is easier to understand what you are trying to do with the code of the tables. Usually you solve this with a fk (
categoria_id
) on the tablenoticia
(since a news may have only one category) and a relationship tabletag_noticia
withfks / pk
=tag_id
andnoticia_id
(since a news may have several tags)– Anthony Accioly
Thanks for the tip, I thought this was done in php, I will study mysql.
– Caymmi