运行常量脚本[关闭]

I'm busy coding a website with adverts that have an expiry date. After the expiry date, the ads cannot show on the website anymore. Normally how I run scripts for expiry dates is running it with a login as its trigger. But with ads, I can't wait until someone logs in to check the ads.

There is already loads of JavaScript running on all the pages, so I would rather not add more.....but I will if its necessary.

I'm not sure how to add a script to run constantly using PHP, only using setInterval() in a JS Script.

Your question seems terribly inconsistent, but it appears that you have the completely wrong approach. To have expiring items, you do not manually deactivate them when the expiry date comes or something like that. You simply have the expiry date as part of the item (say, a column in your database) and you select items which have not yet expired when you select items. E.g.:

SELECT * FROM `ads` WHERE `expiry_date` > NOW()

you mean run the script without reloading/refreshing the page, right? then javascript solution's the best option, as far as i know. Some setInterval to check and perhaps the script to show hide something in php, but the handler should be java/ajax