A
A
Anton Ivanov2017-07-11 13:47:30
Software design
Anton Ivanov, 2017-07-11 13:47:30

How to store the fact of reading the news by the user?

Hello.
Given: Website, Users, News :)
For each news, the user must press the button / check the box that he has read this news. What could be the solution, other than the obvious one, to store a pair of user ID + news ID?
The solution is not very pleasant because each time the page is opened, it will be necessary to search the news table and this table in order to find news that the user has not yet read.
There is another option, to make a table not of "read news", but, on the contrary, of new news. Then, each time the news is added, it will be necessary to record all users of the system in this table, so that later, when the user reads the news, the record will be deleted. Thank you.
Maybe there is a much simpler and more logical solution and I don't see it? :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-07-11
@webinar

Alternatively, the i_read field in the user. There, in the form of json, store a list of id read. Accordingly, when selecting from news, exclude these id. But there are fears that the field limit will be exceeded.
In my opinion, the best option, just the one that somehow confuses you. Namely, a separate table user_id | news_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question