PHP Email Schedule
Discussion
Looking for a PHP script for the following.
User registers on a website, giving their birthday, which is stored in their profile in MySQL.
On the day of their birthday, system sends them an email.
Presumably this means I need a script that runs in the "background" checking the DB for birthdays today. Can this be done in PHP?
Many thanks
thunderstruck
User registers on a website, giving their birthday, which is stored in their profile in MySQL.
On the day of their birthday, system sends them an email.
Presumably this means I need a script that runs in the "background" checking the DB for birthdays today. Can this be done in PHP?
Many thanks
thunderstruck
As the PHP is server side and you probably wont be able to schedule tasks at the webserver end all you'll need to do is write a PHP to submit a query to select records equal to today.
You should be able to create a scheduled task locally that launches explorer pointed at your PHP extract to achieve this.
It should be fairly simple to be honest.
You should be able to create a scheduled task locally that launches explorer pointed at your PHP extract to achieve this.
It should be fairly simple to be honest.
You'll need two PHP's
The first containing a form which submits in INSERT INTO to your mySQL file
The second submits a SELECT FROM table WHERE birthday = [today] then for each record in the result set sends a happy birthday email.
The second one launched from a scheduled task or just launched manually, daily.
The first containing a form which submits in INSERT INTO to your mySQL file
The second submits a SELECT FROM table WHERE birthday = [today] then for each record in the result set sends a happy birthday email.
The second one launched from a scheduled task or just launched manually, daily.
Plotloss said:
You'll need two PHP's
The first containing a form which submits in INSERT INTO to your mySQL file
The second submits a SELECT FROM table WHERE birthday = [today] then for each record in the result set sends a happy birthday email.
The second one launched from a scheduled task or just launched manually, daily.
Cool, that sounds do-able. It's just the scheduled task bit that is stumping me at the mo...
Thats local, as in on your desktop.
So you would have a scheduled task which launches something like:
c:\program files\internet exploreriexplore.exe www.yoursite.co.uk/birthdays/extract.php
This will execute the second PHP at the server end to perform your extract/mail operation.
So you would have a scheduled task which launches something like:
c:\program files\internet exploreriexplore.exe www.yoursite.co.uk/birthdays/extract.php
This will execute the second PHP at the server end to perform your extract/mail operation.
Nah, you'll need to handle the execution of the extract by having a local scheduled task which executes the extract PHP once daily.
You can either do this manually as a daily task or schedule it to occur once a day at a certain time if you have a machine that is on constantly.
All you are doing to create the extract is performing what is effectively a remote procedure call...
You can either do this manually as a daily task or schedule it to occur once a day at a certain time if you have a machine that is on constantly.
All you are doing to create the extract is performing what is effectively a remote procedure call...
Just used something like httprun ( www.icewarp.com/downloads/free.html?PHPSESSID=1cac622c1d7825dcb82d8f46c74918e3 )
to run a web page on a schedule.
to run a web page on a schedule.
Is there a page on the website that's accessed at least once a day? If so then simply have some PHP there to check the dates in the database, and send emails out then. Remember to mark a record after an email's been sent, or they'll get one every time that pages is accessed on their birthday!
There's no page that is guaranteed to be accessed each day, otherwise no probs!
I found a very useful thing called "WebCron" : www.webcron.org/
It let's you set up a cronjob through a very simple interface, so I can now get it to run a script daily for me. Free too.
Thanks for all your help.
I found a very useful thing called "WebCron" : www.webcron.org/
It let's you set up a cronjob through a very simple interface, so I can now get it to run a script daily for me. Free too.
Thanks for all your help.
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


