Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MySQL Database Script

Posted on 2011-03-23
3
Medium Priority
?
287 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 1500 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

705 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