Hello. You need to implement the correct MySQL query. In general, I wondered how to implement the function of subscribing to the latest comments.
There are two tables read: who is subscribed to whom. comments - comments. The read table has 2 columns in which ( kto
, kogo
) (Who subscribed (profile ID), To whom subscribed (profile ID)).
The table with comments has columns ( id
, id_send_user
, id_post
, msg
, time
) (Post ID, Sender Profile ID, Post ID (entries), Self Comment, Time (php - "time ();")).
In MySQL, I only know how to perform basic actions, so I don’t know how to implement it. Ready to listen to any suggestions. Thank you in advance.
I tried this:
SELECT * FROM comments JOIN read ON read.kogo = comments.id_send_user ORDER by time desc LIMIT 15