I think that you just need to put your script in a separate file and run once per day with a cron job
You might want to read more about cron jobs in this post How to create cron job using PHP?
質問
I want to check the stock level every day at a certain time (say 11pm GMT) and email a list of items that are low on stock to the admin. I have managed to get the mailing function working but I am struggling to limit the checks to once a day (right now it sends an email to the admin email every time the page loads)
Your help will be much appreciated!
解決
I think that you just need to put your script in a separate file and run once per day with a cron job
You might want to read more about cron jobs in this post How to create cron job using PHP?
他のヒント
In case that impossible to run a cron job, you can save last mail time in DB or file and check timeout on page load.