Forum Moderators: coopster

Message Too Old, No Replies

How to run PHP process without loading page?

         

tintin99

4:14 pm on Jan 31, 2011 (gmt 0)

10+ Year Member



I have a PHP/MySQL course booking system on my website and I would like to automatically send reminder emails to people who haven't paid two weeks before the course starts.

I know how to do this by a PHP script on a web page, but I wonder if it's possible to set it up so it happens automatically in the background without going to the site?

Thanks,

Bob.

Matthew1980

4:32 pm on Jan 31, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there tintin99,

I could be wrong here (long day) but isn't that the point of a cron job? You can set those up to run specified scripts 'in the background' whenever and how often you want.

Cheers,
MRb

rocknbil

4:37 pm on Jan 31, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cron it, right, but your script will have to have something like

select * from table where course_start >= date_add(now(),interval 2 week) and paid=0 and notified=0;

If your date field is date only, not datetime, use curdate() instead of now.

The notified field is important, otherwise it will send one email every day after the two week mark. Once emailed, be sure to update notified to 1.

tintin99

4:46 pm on Jan 31, 2011 (gmt 0)

10+ Year Member



I'd never come across cron before but I've just Googled it and it looks like what I need.

Many thanks guys!