Send an email alert to each user of the php application based on criteria

The hosted php application has a mysql database. The following conditions must be true to trigger the email notice at a specific time. I’m using general terms to get the idea across.

  1. the initial “form” must be approved; form A baseline “0”
  2. the “form” must be less than 100%;
  3. the previous “form” must be approved; form B revisions “1,2,3…”
    All three of these conditions are fields in the database.
    A cutoff deadline date is set for each record for instance day 20, which could be any month.
    The event is triggered when the all of the above conditions are true and 7 days prior to the cutoff day an email notice is sent to all records meeting the conditions. In this example the email will go out on day 13 each month until a false condition exists.
    Can this be programmed in PHP? Can you provide a sample code?

No sorry, I have no idea whet you try to do here.

To do something when conditons are met you use :
[php]
if ( BOOLEAN )
{ // here you’d send your mail
}
[/php]

if all data is in the database you should be able to write an SQL query to find all records for which the conditions are met, in that case you iterate through all the retrieved records and mail them.

Run this script the 13th of every month and you send the mails every month on the 13th.
( Most operating systems have schedulers for this )

I hope it at least helps you somewhat or maybe helps you restate the question so others may be able to pick it up.

Good luck,
O.

Sponsor our Newsletter | Privacy Policy | Terms of Service