How do I paginate by categories and tags?

Asked

Viewed 60 times

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?

  • I do not know, I started a month to study php, I am creating a project to practice.

  • 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 table noticia (since a news may have only one category) and a relationship table tag_noticia with fks / pk = tag_id and noticia_id (since a news may have several tags)

  • Thanks for the tip, I thought this was done in php, I will study mysql.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.