Solved

MySQL Database Script

Posted on 2011-03-23
3
283 Views
Last Modified: 2012-05-11
I have a MySQL database that consist of first names, last names, and dates. Does anyone know if it is possible for me to use some type of script that runs agains certain date fields & if a date is within 6 days of todays date, it will automatically send an email to someone reminding them they are within 6 days of that date?
0
Comment
Question by:wantabe2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
tygrus2 earned 500 total points
ID: 35203179
Your problem is in three parts.
1) List people who have "expiryDate - TodaysDate < 6" condition;
2) Add another table or field to record when they were notified;
3) Send email to required users in step1 to warn of expiry that have not previously been notified, see step2.
The 2nd part is required if you only want to send it once to a user and not everyday as a countdown. You may need to round the dates to 0 decimal places for 00:00AM which could help to simplyfy the "expiryDate - TodaysDate = 6" condition. What do you want to do with those who have reached the expiryDate ? How many reminders ?

The third part is more difficult but should be able to do in PHP if you have a mail server that will send email without authentication. There may be other ways to automate the process but you may like the manual trigger to check the list before sending.
0
 
LVL 15

Author Comment

by:wantabe2
ID: 35206161
Does anyone have a sample script to do some of this?
0
 
LVL 15

Author Closing Comment

by:wantabe2
ID: 35214261
This did not help me but thanks anyway.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question