View Full Version : anybody know tuts on php cron job script writing?

09-21-2007, 12:59 AM
Hi instead of me writing individual reminders emails to expired listings on my directory I am wanting to set up a cron to do this for me automatically.
My host said to let them know of what cronjob they want me to run and at what frequency. Now this is where I need to learn - the scripting part and what are the consequences of doing this.

09-21-2007, 05:22 AM
all you do is write your PHP script as normal with a .php extension

dont add any output like HTML or echos

tell your host the script to run and at what time you want it to run and thats it.

make sure you test it first

09-21-2007, 06:03 AM
Thanks - so to have the database input I should do something like:
Connect to database with

require_once("Connections/connect.php"); so long as it is in the same directory
Then do a sql query to find the email addresses of the listings that the expiry date is .....how do I check for past the current date or leading up to the current date?
Then set up the email address etc.
The other question do I use explode for the email addresses as an array and use the delimiter ,
Then do I exit or does it do it automatically from the database?
Sorry for all the questions I am trying to piece it all together so that I can change it for other purposes later.