ok here it goes. I have a page where the user can enter a search term for them to be emailed at a frequency they desire. The search page has a bunch of terms lists etc and a place for their name email and the frequency they want to be emailed. ie once a day, week , or month. This page goes to another page where all this info is entered into a mysql database. name email frequency and search query. So I want to set up a cron that sends the emails out. This is where I am a bit curious at what you experienced programmers would do. Should I have 3 pages. ie one script for day emails,one for week and one for month emails? Then set up a cron for each one. As well what would be the best way to go thru the database and email each query. I was thinking of some for loop. that pulls the data where frequency = days then loop thru each row and perform a query then email that result. Does this sound like the right course of action? Well i appreciate any advice you can offer thanks
Personally I would just develop this in one PHP script that is run on the cron daemon rather than 3. Select the users that are to be contacted and loop through them, then select the data that is to be delivered to them, send the email and voila, job done.
you have one more option ... try searching about the triggers in MySQL .. so that for each insert operation on database you can check for the new entries and will be able to send emails to users using some other method in phjp