开发者

How can I have a function perform after a Datetime in my DB is met?

I'm creating an auction site where users can bid on items. I want to create a script that sends an email to the winner of an auction item once the datetime in the end_auction column has been reached.

I'm not sure how to go about doing this, since PHP only runs when the page is loaded and then stops. Also, I want it to send an email to the winner once the auction is over even when nobody is looking at any page.

So i guess I need some sort of functionality that will constantly check my server to see if the end_auction DateTime of an event has been met and then send them an email using the Mail funct开发者_运维百科ion if it has.

What programming languages would I need? What approach could I use to make this happen?


A dedicated program or script could handle this. It need not have a GUI, since its operations are:

list all users with closed auctions who have not been notified
for each user in the list
    email notification
    if no error, mark user notified

Choose your poison. PHP can do this outside a webserver, as can Perl, Python, Java, etc., etc.


You could write your logic in php and schedule your php script to run using cron.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜