网站数据库不自动更新[重复]

This question already has an answer here:

I have a script which i made myself, it's doing the following: -Crawl database to see if current date equals date of a value in the database if true: Add +7 days to the date and then get the Ascending value of a date. It's supposed to update each sunday

but the problem is: The crawling and updating only happends if someone visits the website specifically on the date where it's supposed to be updated.

So for instance if there is a date in the database which equals 2019/1/11 and the current date is 2019/1/11 , it's updating it to that date + 7 days.

BUT only updates when visiting the site on 2019/1/11. If visiting the site on 2019/1/12 the updating does not work anymore

How can i make it update itself / running the php code without someone having to visit it for it to update?

</div>

Set cron job and run it everyday one time and check current date equals or greater than date of a value in the database

You have done something that is called "a poor man's cron". You need to have true "cron"(a scheduler on server, which runs your script). Any reasonable hosting service these days have it.