Answer the question
In order to leave comments, you need to log in
How can I display articles with a category, tags with such tables?
post table
+----+---------+-----------------+
| id | title | text |
+----+---------+-----------------+
| 1 | Title 1 | This is example |
| 2 | Title 2 | This is example |
| 3 | Title 3 | This is example |
+----+---------+-----------------+
+----+--------+
| id | tag |
+----+--------+
| 1 | jQuery |
| 2 | PHP |
| 3 | Stack |
+----+--------+
+----+------------+
| id | category |
+----+------------+
| 1 | Category 1 |
| 2 | Category 2 |
| 3 | Category 3 |
+----+------------+
+---------+--------+
| post_id | tag_id |
+---------+--------+
| 1 | 1 |
| 1 | 2 |
| 2 | 3 |
+---------+--------+
+---------+------------------+--------------------+------------+
| Title | Text | Tag | Category |
+---------+------------------+--------------------+------------+
| Title 1 | This is example | jQuery, PHP | Category 2 |
| Title 2 | This is example | Stack | Category 1 |
| Title 3 | This is example | jQuery, PHP, Stack | Category 1 |
+---------+------------------+--------------------+------------+
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question