jetsettt Posted January 10, 2011 Share Posted January 10, 2011 Hi all, I have a website where I would like a member to have the option to 'Like' a posted article (just like the Facebook option). My current thought is to have a seperate table that holds the user ID and the posted article ID which is then queried to show how many members 'Like' a posted article by counting the matching rows for a posted article ID. My question.... is this a good way to do this if there will be many 'Like' entries for a posted article, is this how Facebook would do it? Another way I have seen is that comma seperated ID's for the members that 'Like' could be stored in just one field with the posted article entry which means I would not have to use a seperate table to hold the 'Like' entries. Easier option, as no seperate table required? Any advice would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/223952-storing-a-facebook-style-like-option/ Share on other sites More sharing options...
jdavidbakr Posted January 10, 2011 Share Posted January 10, 2011 I think you're on the right track with having a relational table between each user and the articles they like. Using a comma-separated field is most always a no-no; if your table is indexed properly, you can get the count of how many people like an article very quickly and efficiently: select count(*) from liketable where article_id = 1 Quote Link to comment https://forums.phpfreaks.com/topic/223952-storing-a-facebook-style-like-option/#findComment-1157481 Share on other sites More sharing options...
fenway Posted January 10, 2011 Share Posted January 10, 2011 The delimited list is only appropriate for summary tables. Quote Link to comment https://forums.phpfreaks.com/topic/223952-storing-a-facebook-style-like-option/#findComment-1157570 Share on other sites More sharing options...
jetsettt Posted January 11, 2011 Author Share Posted January 11, 2011 Thanks guys. That clears it up for me. I will stick to the relational table setup. Quote Link to comment https://forums.phpfreaks.com/topic/223952-storing-a-facebook-style-like-option/#findComment-1157940 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.