How to solve this? Commentary subscription

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

How to solve this? Commentary subscription

Post by JKM »

Hi there,

I'm having a small page with ~30 users, and I'm using the same MySQL-table for a comment system I made. The field 'type' indicates if it's a picture, movie or what, and the field 'parents' indicates the picture/movie id. But I want some a subscription feature (notification on new comments). It should send an email to the users that's checked the 'subscribe' checkbox. So I'm thinking about making another table for subscription list, but I'm not sure how I should do it. Any ideas?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: How to solve this? Commentary subscription

Post by AbraCadaver »

That sounds right. A subscriptions table with the user_id and the comment_id. When someone subscribes you just insert the user_id and comment_id. When a new comment is posted query the table and select all user_ids where comment_id equals the current comment and join on the users table to get the email addresses. Then pass the addresses off to a routine that emails the notice.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
JKM
Forum Contributor
Posts: 221
Joined: Tue Jun 17, 2008 8:12 pm

Re: How to solve this? Commentary subscription

Post by JKM »

AbraCadaver wrote:That sounds right. A subscriptions table with the user_id and the comment_id. When someone subscribes you just insert the user_id and comment_id. When a new comment is posted query the table and select all user_ids where comment_id equals the current comment and join on the users table to get the email addresses. Then pass the addresses off to a routine that emails the notice.
Hmm, let me try.

Thanks!
Post Reply