lundi 18 septembre 2017

How to run a php file on a specific date that's polled from database?

I am trying to run a php file on a specific date that's polled from mysql database. I know that I can use cron job but the problem is that the date is updated once in a while. so I don't have a fixed date that I could use to set up my cron job.The only way that I could get the date is from the database.

I know there is another option that I write code in my php file to check if today is the date, if it is, execute the code. If it is not, do nothing. Then set a cron job that runs everyday for this php file. But the problem will be that the interval between the date is usually 1 to 3 months. Would it be a very bad idea to check it everyday but only run it every 1 or 3 month?

I am trying to run the php file to update the data of a website. If I just put the php code in the code of the website to check the date, will that work?

Is there a better way of doing this? Thank you.

Aucun commentaire:

Enregistrer un commentaire