View Full Version : email database output each night
Hello. I have almost no experience on linux based web hosting and mysql. I would like to know if it's possible to email myself 2 sql statement results each night. How would I go about doing this through PHP and schedule the scripts to run? I think I can do the php to pull a result set for each script, but don't know how to send them to an email and schedule it to run everynight.
Any help is appreciated! TIA
use cron to kick off the script each night. you will find an example of how to do that in the Tips & Scripts page link in my signature.
then use the mail function to send yourself the results. you can also find examples of the use of the mail function in several of the scripts on that page.
create a PHP file to run the sql commands. Either create a big $var and send that in the body of a mail(), or create a file with it, and attach it to the email using additional headers in the mail() function. Plenty of examples if you look around.
As for scheduling it, check out the cron tutorial on http://support.powweb.com under tutorials.
Thanks for the info guys!
vBulletin v3.6.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.