Trigger or Cron

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ScottCFR
Forum Commoner
Posts: 33
Joined: Sat Jun 19, 2010 7:36 pm

Trigger or Cron

Post by ScottCFR »

I am working on an "announcement" system, and I want to have an expire option, so that it removes it's self from my site, but stays in the sql. I have everything ready, I just never messed with triggers before. I don't know if I should try cron at the same time..

Thanks,
Scott W.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Trigger or Cron

Post by Weirdan »

Set the expire date and filter out expired items in your selects:

Code: Select all

select anouncement.*
from announcement
//...
where expireDate > now()
//...
ScottCFR
Forum Commoner
Posts: 33
Joined: Sat Jun 19, 2010 7:36 pm

Re: Trigger or Cron

Post by ScottCFR »

Are you saying, when the page is visited, check to see if the announcement is expired? If so.. why didn't I think of that lol.
Post Reply