G
G
g_oo_gle2015-10-06 00:11:40
PHP
g_oo_gle, 2015-10-06 00:11:40

Is there a separate table with likes for each article?

For each article, store a separate table with records about users who liked it?
Or is there another way out?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2015-10-06
@g_oo_gle

Normal Form
Roughly speaking, likes are a many-to-many relationship between articles and users. If you need to store additional information (like the time the user liked), then an intermediate table is entered and linked to both users and articles.

A
AlikDex, 2015-10-06
@AlikDex

remembering the last question of this user, I will say the following:
Yes, each article needs its own table with likes :D
All the best =)

F
fedot1325, 2015-10-06
@fedot1325

article_likes
id | user_id | article_id
SELECT user_id FROM article_likes WHERE article_id=x

A
Alexey, 2015-10-06
@dzheka3d

The table with likes should simply contain fields with the id of the article and the id or ip of the user

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question