PHP/MYSQL:电子邮件通知数据库表 [英] PHP/MYSQL: Database Table For Email Notifications

查看:48
本文介绍了PHP/MYSQL:电子邮件通知数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将网站上的更改通知用户.用户订阅了不同类型的更改,因此我不会将所有更改发送给所有用户.

I want to notify users of changes on a site. Users are subscribed to different kinds of changes so I don't send all changes to all users.

这是我的想法:在 t=0(即检查某个表是否为空的 if 语句)我基本上有一个 SQL 查询,可以获取适当的更改并将邮件发送给适当的用户.然后我填充一个 user_changes 表,该表本质上存储了哪些更改已邮寄给哪些用户.邮件是通过 php mail 函数

Here's what I am thinking: at t=0 (i.e. an if statement that checks that some table is empty) I basically have an SQL query that fetches the appropriate changes and mails to the appropriate users. I then populate a user_changes table which essentially stores what changes have been mailed to what users. Mailing is done with the php mail function

然后在 t>0 处,我再次运行 SQL 查询,但这次的条件是 changes+user 不在 user_changes 表中.我看到的主要问题是 user_changes 表可能会很快变大.这是一个问题吗?我试图避免使用日期来过滤内容的黑客行为,因为我希望新用户能够接收与他们相关的旧更改.

Then at t>0, I run the SQL query again but this time with the condition that changes+user are not in the user_changes table. The main issue i see with this is that the user_changes table could get large very quickly. Is this a problem? I am trying to avoid hacks that use dates to filter stuff, since I want new users to be able to receive old changes that are relevant to them.

感谢建议.

推荐答案

让每个用户有一个条目,并记录更新的最后一个序列号怎么样?当您发送电子邮件更新时,用最新和最好的更新记录.那么,您的表格应该根据您的用户群调整大小.

How about having one entry per user, and a record of the last sequence number of updates? when you send the email updates, update the record with the latest and greatest. Your table should be sized with your user base, then.

这篇关于PHP/MYSQL:电子邮件通知数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆