How can I query mysql for changes once a day, then send email if data is added/changed

I don't have any code to share as I'm very unsure where to start with this. But basically I would like to send an email using PHP once a day.

I.e. it will run a piece of script automatically (without a browser / front end) on the server. It will query a MySQL database for any changes, if there are any changes then I want PHP to send an email.

I'm familiar with querying and sending emails, I'm just not sure how to do this automatically without user input/ POST request etc. Can I make an infinite loop or will that block all other scripts on my server? Can this be done in PHP or should I use another language?

If anyone can point me in the right direction? Thanks in advance.

Upvotes: 0

Views: 188

Answers (1)

heyheygg
heyheygg

Reputation: 56

You have to set up a cron job that will run the your php script every day. This should help you: How to create cron job using PHP?

Upvotes: 2

Related Questions