Jump to content

How would I do this?


johnsmith153

Recommended Posts

My PHP is "quite good" but I am thinking how I would do this:

 

Table 1 holds settings / table 2 holds 'invoices' created. The system generates invoices when neeeded based on a subscription.

 

Once a day a CRON will run a script.

 

The script will check table 1 and based on findings may then add a record to table 2.

 

Table 1 holds dates and frequency of action, so a record may hold:

 

date field: June 4th 2009

frequency field: Monthly

 

or:

 

date field: 26th September 2009 (which is a Saturday)

frequency field: Weekly

 

When the CRON runs (runs once a day) and checks table 1 I want it to pick up if an invoice needs to be created. In the above case, 4th October would trigger an invoice for the first one and Saturday 3rd October for the second one.

 

I can do everything with dates etc. just wondering how best to do it (I imagine store the time() value in table 1 and then some form of calculation to work out if it hits the frequency)

 

Link to comment
https://forums.phpfreaks.com/topic/176278-how-would-i-do-this/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.