0

Basically, am creating a mailer system to send a mail to my inactive members to do activities in their account if they have not logged in since 30 days.

My previous login date stores in my database in unixtimestamp hence i coded as below.

select email from myusers where WHERE DATE_ADD(FROM_UNIXTIME(prelogin), INTERVAL 30 DAY) < CURDATE()";

But this code after 30 days it is sending continuos mails almost everyday as i have set cron to run once a day

Can someone help please

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by vibhaJ
0

Hi,

You can try creating another column on your members table, you can name it anything e.g. notified..

Just right after your script send the email, update this column by inserting some indicator e.g true or false

You can then modify your query above to something like this...

select email from myusers WHERE notified = 'false' AND DATE_ADD(FROM_UNIXTIME(prelogin), INTERVAL 30 DAY) < CURDATE()";
## do your update query below
update myusers WHERE .....set notified value to true, for all affected rows above...

Edited by veedeoo: more info added

0

If you are adding your php age in cronjob and assuming it will run daily you can use '<=' as shown below query
.

select email from myusers where WHERE DATE_ADD(FROM_UNIXTIME(prelogin), INTERVAL 30 DAY) <= CURDATE()";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.